mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-17 11:05:05 +00:00
Some clean up on starting up, shutting down and resetting the profiler.
This commit is contained in:
1 parent
1a55456fb3
commit
34a90eec12
7 files changed
+32
-38
No files matched your search
@@ -35,9 +35,7 @@ public class OpisClientTickHandler implements ITickHandler {
|
||||
else if (profilerRunningTicks >= modOpis.profilerMaxTicks && modOpis.profilerRun){
|
||||
profilerRunningTicks = 0;
|
||||
modOpis.profilerRun = false;
|
||||
ProfilerRegistrar.registerProfilerTileEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerTick(new DummyProfiler());
|
||||
ProfilerRegistrar.turnOff();
|
||||
|
||||
//TODO : Print something to the client chat
|
||||
System.out.printf("Profiling done\n");
|
||||
|
||||
@@ -7,6 +7,7 @@ import mcp.mobius.mobiuscore.profiler.ProfilerRegistrar;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.managers.MetaManager;
|
||||
import mcp.mobius.opis.data.managers.TickHandlerManager;
|
||||
import mcp.mobius.opis.data.managers.TileEntityManager;
|
||||
import mcp.mobius.opis.network.server.Packet_ClearSelection;
|
||||
@@ -35,18 +36,7 @@ public class CommandReset extends CommandBase implements IOpisCommand {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
modOpis.profilerRun = false;
|
||||
|
||||
modOpis.selectedBlock = null;
|
||||
OpisServerTickHandler.instance.profilerRunningTicks = 0;
|
||||
TileEntityManager.references.clear();
|
||||
TileEntityManager.stats.clear();
|
||||
EntityManager.stats.clear();
|
||||
TickHandlerManager.startStats.clear();
|
||||
TickHandlerManager.endStats.clear();
|
||||
ProfilerRegistrar.registerProfilerTileEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerEntity( new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerTick(new DummyProfiler());
|
||||
MetaManager.reset();
|
||||
|
||||
if (icommandsender instanceof EntityPlayer)
|
||||
PacketDispatcher.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oInternal data reseted."))), (Player)icommandsender);
|
||||
|
||||
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.Player;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.managers.MetaManager;
|
||||
import mcp.mobius.opis.data.managers.TickHandlerManager;
|
||||
import mcp.mobius.opis.data.managers.TileEntityManager;
|
||||
import mcp.mobius.opis.data.server.EntityProfiler;
|
||||
@@ -36,18 +37,9 @@ public class CommandStart extends CommandBase implements IOpisCommand {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
MetaManager.reset();
|
||||
modOpis.profilerRun = true;
|
||||
|
||||
OpisServerTickHandler.instance.profilerRunningTicks = 0;
|
||||
TileEntityManager.references.clear();
|
||||
TileEntityManager.stats.clear();
|
||||
EntityManager.stats.clear();
|
||||
TickHandlerManager.startStats.clear();
|
||||
TickHandlerManager.endStats.clear();
|
||||
|
||||
ProfilerRegistrar.registerProfilerTileEntity(new TileEntityProfiler());
|
||||
ProfilerRegistrar.registerProfilerEntity(new EntityProfiler());
|
||||
ProfilerRegistrar.registerProfilerTick(new TickHandlerProfiler());
|
||||
ProfilerRegistrar.turnOn();
|
||||
|
||||
if (icommandsender instanceof EntityPlayer){
|
||||
OpisServerTickHandler.instance.players.add((EntityPlayer)icommandsender);
|
||||
|
||||
@@ -32,10 +32,7 @@ public class CommandStop extends CommandBase implements IOpisCommand {
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
modOpis.profilerRun = false;
|
||||
|
||||
ProfilerRegistrar.registerProfilerTileEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerTick(new DummyProfiler());
|
||||
ProfilerRegistrar.turnOff();
|
||||
|
||||
if (icommandsender instanceof EntityPlayer)
|
||||
OpisServerTickHandler.instance.players.add((EntityPlayer)icommandsender);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package mcp.mobius.opis.data.managers;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerRegistrar;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.server.OpisServerTickHandler;
|
||||
|
||||
public class MetaManager {
|
||||
|
||||
public static void reset(){
|
||||
modOpis.profilerRun = false;
|
||||
modOpis.selectedBlock = null;
|
||||
OpisServerTickHandler.instance.profilerRunningTicks = 0;
|
||||
TileEntityManager.references.clear();
|
||||
TileEntityManager.stats.clear();
|
||||
EntityManager.stats.clear();
|
||||
TickHandlerManager.startStats.clear();
|
||||
TickHandlerManager.endStats.clear();
|
||||
ProfilerRegistrar.turnOff();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.client.OpisClientTickHandler;
|
||||
import mcp.mobius.opis.data.client.TickHandlerClientProfiler;
|
||||
import mcp.mobius.opis.data.holders.TickHandlerStats;
|
||||
import mcp.mobius.opis.data.managers.MetaManager;
|
||||
import mcp.mobius.opis.data.managers.TickHandlerManager;
|
||||
|
||||
public class ClientCommandHandler {
|
||||
@@ -25,12 +26,9 @@ public class ClientCommandHandler {
|
||||
if (cmd == ClientCommand.START_PROFILING){
|
||||
modOpis.log.log(Level.INFO, "Started profiling");
|
||||
|
||||
MetaManager.reset();
|
||||
modOpis.profilerRun = true;
|
||||
OpisClientTickHandler.instance.profilerRunningTicks = 0;
|
||||
TickHandlerManager.startStats.clear();
|
||||
TickHandlerManager.endStats.clear();
|
||||
|
||||
ProfilerRegistrar.registerProfilerTick(new TickHandlerClientProfiler());
|
||||
ProfilerRegistrar.turnOn();
|
||||
}
|
||||
else if (cmd == ClientCommand.SHOW_RENDER_TICK){
|
||||
modOpis.log.log(Level.INFO, "=== RENDER TICK ===");
|
||||
|
||||
@@ -55,9 +55,7 @@ public class OpisServerTickHandler implements ITickHandler {
|
||||
else if (profilerRunningTicks >= modOpis.profilerMaxTicks && modOpis.profilerRun){
|
||||
profilerRunningTicks = 0;
|
||||
modOpis.profilerRun = false;
|
||||
ProfilerRegistrar.registerProfilerTileEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerEntity(new DummyProfiler());
|
||||
ProfilerRegistrar.registerProfilerTick(new DummyProfiler());
|
||||
ProfilerRegistrar.turnOff();
|
||||
|
||||
for (EntityPlayer player : players)
|
||||
PacketDispatcher.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oOpis automaticly stopped after %d ticks.", modOpis.profilerMaxTicks))), (Player)player);
|
||||
|
||||
Reference in new issue
Block a user