Skip to content

Commit

Permalink
Fix 0 TPS and Infinity time/tick with periodic profiling disabled.
Browse files Browse the repository at this point in the history
Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed May 30, 2013
1 parent df27c75 commit 105b2b2
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/common/me/nallar/tickprofiler/minecraft/TickProfiler.java
Expand Up @@ -67,14 +67,6 @@ public TickProfiler() {
@Mod.Init
public void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
initPeriodicProfiling();
}

private void initPeriodicProfiling() {
final int profilingInterval = this.profilingInterval;
if (profilingInterval == 0) {
return;
}
TickRegistry.registerScheduledTickHandler(new ProfilingScheduledTickHandler(profilingInterval, MinecraftServer.getServer().getFile(profilingFileName)), Side.SERVER);
}

Expand Down Expand Up @@ -178,7 +170,8 @@ public int nextTickSpacing() {
public void tickStart(final EnumSet<TickType> type, final Object... tickData) {
final EntityTickProfiler entityTickProfiler = EntityTickProfiler.ENTITY_TICK_PROFILER;
entityTickProfiler.tick();
if (counter++ % (profilingInterval * 60 * 20) != 0) {
int profilingInterval = this.profilingInterval;
if (profilingInterval <= 0 || counter++ % (profilingInterval * 60 * 20) != 0) {
return;
}
entityTickProfiler.startProfiling(new Runnable() {
Expand Down

0 comments on commit 105b2b2

Please sign in to comment.