diff --git a/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java b/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java index 435c14e..f917590 100644 --- a/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java +++ b/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java @@ -30,6 +30,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetHandler; import net.minecraft.network.NetworkManager; +import net.minecraft.profiler.Profiler; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraft.world.storage.SaveHandler; @@ -89,6 +90,7 @@ private WeakReference handlerToCheck; private EventBus eventBus = new EventBus(); private volatile CountDownLatch exitLatch = null; + private Profiler profiler; /** * The FML event bus. Subscribe here for FML related events * @@ -244,7 +246,9 @@ public void onPostServerTick() { + profiler.startSection("forge_onPostServerTick"); bus().post(new TickEvent.ServerTickEvent(Phase.END)); + profiler.endSection(); } /** @@ -252,12 +256,16 @@ */ public void onPostWorldTick(World world) { + profiler.startSection("forge_onPostWorldTick"); bus().post(new TickEvent.WorldTickEvent(Side.SERVER, Phase.END, world)); + profiler.endSection(); } public void onPreServerTick() { + profiler.startSection("forge_onPreServerTick"); bus().post(new TickEvent.ServerTickEvent(Phase.START)); + profiler.endSection(); } /** @@ -265,7 +273,9 @@ */ public void onPreWorldTick(World world) { + profiler.startSection("forge_onPreWorldTick"); bus().post(new TickEvent.WorldTickEvent(Side.SERVER, Phase.START, world)); + profiler.endSection(); } public boolean handleServerAboutToStart(MinecraftServer server) @@ -275,6 +285,7 @@ public boolean handleServerStarting(MinecraftServer server) { + this.profiler = server.theProfiler; return Loader.instance().serverStarting(server); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index cdc9f49..39648e5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -560,8 +560,6 @@ public void tick() { long i = System.nanoTime(); - FMLCommonHandler.instance().onPreServerTick(); - ++this.tickCounter; if (this.startProfiling) { @@ -571,6 +569,8 @@ } this.theProfiler.startSection("root"); + FMLCommonHandler.instance().onPreServerTick(); + ++this.tickCounter; this.updateTimeLightAndEntities(); if (i - this.field_147142_T >= 5000000000L) @@ -617,8 +617,8 @@ } this.theProfiler.endSection(); - this.theProfiler.endSection(); FMLCommonHandler.instance().onPostServerTick(); + this.theProfiler.endSection(); } public void updateTimeLightAndEntities()