mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-19 19:59:37 +00:00
Removed most of the subcommands from WorldTickProfiler
Profilers are now using generic Objects are params.
This commit is contained in:
1 parent
812a9e29f5
commit
9e2f073652
5 files changed
+12
-111
No files matched your search
@@ -20,19 +20,6 @@ public enum GlobalTimingManager {
|
||||
public HashMap<Integer, StatsWorld> worldTickStats = new HashMap<Integer, StatsWorld>();
|
||||
public HashMap<Integer, StatsWorld> entUpdateStats = new HashMap<Integer, StatsWorld>();
|
||||
|
||||
HashBasedTable<Integer, String, StatsWorld> statsDim = HashBasedTable.create();
|
||||
HashBasedTable<CoordinatesChunk, String, StatsChunkMedian> statsChunk = HashBasedTable.create();
|
||||
|
||||
|
||||
/*
|
||||
public static HashMap<Integer, StatsWorld> worldUpdatesStats = new HashMap<Integer, StatsWorld>();
|
||||
public static HashMap<Integer, StatsWorld> worldBlocksAndAmbianceStats = new HashMap<Integer, StatsWorld>();
|
||||
public static HashMap<Integer, StatsWorld> worldPlayerInstancesStats = new HashMap<Integer, StatsWorld>();
|
||||
public static HashMap<Integer, StatsWorld> worldVillageCollectionStats = new HashMap<Integer, StatsWorld>();
|
||||
public static HashMap<Integer, StatsWorld> worldVillageSiegeStats = new HashMap<Integer, StatsWorld>();
|
||||
public static HashMap<Integer, StatsWorld> worldApplyBlockEventsStats = new HashMap<Integer, StatsWorld>();
|
||||
*/
|
||||
|
||||
/* Add an entity to the stat array, with timing data */
|
||||
public void addStat(int id, long timing, HashMap<Integer, StatsWorld> target){
|
||||
if (!(target.containsKey(id)))
|
||||
@@ -46,52 +33,4 @@ public enum GlobalTimingManager {
|
||||
total += target.get(dim).getGeometricMean();
|
||||
return total;
|
||||
}
|
||||
|
||||
public void addStat(int id, String subsection, long timing){
|
||||
if (!statsDim.contains(id, subsection)){
|
||||
statsDim.put(id, subsection, new StatsWorld(id));
|
||||
}
|
||||
statsDim.get(id, subsection).addMeasure(timing);
|
||||
}
|
||||
|
||||
public void addStat(CoordinatesChunk coord, String subsection, long timing){
|
||||
|
||||
if (!statsChunk.contains(coord, subsection)){
|
||||
statsChunk.put(coord, subsection, new StatsChunkMedian(coord));
|
||||
}
|
||||
statsChunk.get(coord, subsection).addMeasure(timing);
|
||||
}
|
||||
|
||||
public HashBasedTable<CoordinatesChunk, String, Double> getStatsChunk(){
|
||||
HashBasedTable<CoordinatesChunk, String, Double> timings = HashBasedTable.create();
|
||||
|
||||
for(Table.Cell<CoordinatesChunk, String, StatsChunkMedian> cell : this.statsChunk.cellSet()){
|
||||
timings.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue().getGeometricMean());
|
||||
}
|
||||
|
||||
return timings;
|
||||
}
|
||||
|
||||
public HashBasedTable<Integer, String, Double> getStatsDim(){
|
||||
HashBasedTable<Integer, String, Double> timings = HashBasedTable.create();
|
||||
|
||||
for(Table.Cell<Integer, String, StatsWorld> cell : this.statsDim.cellSet()){
|
||||
timings.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue().getGeometricMean());
|
||||
}
|
||||
|
||||
return timings;
|
||||
}
|
||||
|
||||
public HashBasedTable<Integer, String, Double> getStatsDimPerSection(){
|
||||
HashBasedTable<Integer, String, Double> timings = HashBasedTable.create();
|
||||
|
||||
for(Table.Cell<CoordinatesChunk, String, StatsChunkMedian> cell : this.statsChunk.cellSet()){
|
||||
if (!timings.contains(cell.getRowKey().dim, cell.getColumnKey()))
|
||||
timings.put(cell.getRowKey().dim, cell.getColumnKey(), 0.0);
|
||||
|
||||
timings.put(cell.getRowKey().dim, cell.getColumnKey(), timings.get(cell.getRowKey().dim, cell.getColumnKey()) + cell.getValue().getGeometricMean());
|
||||
}
|
||||
|
||||
return timings;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ public class MetaManager {
|
||||
TickHandlerManager.endStats.clear();
|
||||
GlobalTimingManager.INSTANCE.worldTickStats.clear();
|
||||
GlobalTimingManager.INSTANCE.entUpdateStats.clear();
|
||||
GlobalTimingManager.INSTANCE.statsDim.clear();
|
||||
ProfilerRegistrar.turnOff();
|
||||
|
||||
ProfilerSection.desactivateAll();
|
||||
|
||||
@@ -13,20 +13,22 @@ public class ProfilerDimTick implements IProfilerBase {
|
||||
public HashMap<Integer, DescriptiveStatistics> data = new HashMap<Integer, DescriptiveStatistics>();
|
||||
|
||||
@Override
|
||||
public void start(World key) {
|
||||
if (key.isRemote) return;
|
||||
public void start(Object key) {
|
||||
World world = (World)key;
|
||||
if (world.isRemote) return;
|
||||
|
||||
if (!data.containsKey(key.provider.dimensionId))
|
||||
data.put(key.provider.dimensionId, new DescriptiveStatistics(20));
|
||||
if (!data.containsKey(world.provider.dimensionId))
|
||||
data.put(world.provider.dimensionId, new DescriptiveStatistics(20));
|
||||
clock.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(World key) {
|
||||
if (key.isRemote) return;
|
||||
public void stop(Object key) {
|
||||
World world = (World)key;
|
||||
if (world.isRemote) return;
|
||||
|
||||
clock.stop();
|
||||
data.get(key.provider.dimensionId).addValue((double)clock.timeDelta);
|
||||
data.get(world.provider.dimensionId).addValue((double)clock.timeDelta);
|
||||
}
|
||||
|
||||
/* UNUSED */
|
||||
@@ -35,7 +37,8 @@ public class ProfilerDimTick implements IProfilerBase {
|
||||
@Override
|
||||
public void stop() {/*UNUSED*/}
|
||||
@Override
|
||||
public void start(Integer key) {/*UNUSED*/}
|
||||
public void start(Object key1, Object key2) {/*UNUSED*/}
|
||||
@Override
|
||||
public void stop(Integer key) {/*UNUSED*/}
|
||||
public void stop(Object key1, Object key2) {/*UNUSED*/}
|
||||
|
||||
}
|
||||
@@ -33,36 +33,4 @@ public final class WorldTickProfiler extends AbstractProfiler implements IProfil
|
||||
this.clock.stop();
|
||||
GlobalTimingManager.INSTANCE.addStat(id, this.clock.timeDelta, GlobalTimingManager.INSTANCE.worldTickStats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDim(int dim, String subsection) {
|
||||
if (!clocksDim.contains(dim, subsection)){
|
||||
clocksDim.put(dim, subsection, new Clock());
|
||||
}
|
||||
clocksDim.get(dim, subsection).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopDim(int dim, String subsection) {
|
||||
clocksDim.get(dim, subsection).stop();
|
||||
GlobalTimingManager.INSTANCE.addStat(dim, subsection, clocksDim.get(dim, subsection).timeDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startChunk(int dim, ChunkCoordIntPair chunk, String subsection) {
|
||||
CoordinatesChunk coord = new CoordinatesChunk(dim, chunk);
|
||||
if (!clocksChunk.contains(coord, subsection)){
|
||||
clocksChunk.put(coord, subsection, new Clock());
|
||||
}
|
||||
clocksChunk.get(coord, subsection).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopChunk(int dim, ChunkCoordIntPair chunk, String subsection) {
|
||||
CoordinatesChunk coord = new CoordinatesChunk(dim, chunk);
|
||||
clocksChunk.get(coord, subsection).stop();
|
||||
GlobalTimingManager.INSTANCE.addStat(coord, subsection, clocksChunk.get(coord, subsection).timeDelta);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -136,14 +136,6 @@ public class OpisServerTickHandler implements ITickHandler {
|
||||
OpisPacketHandler.sendFullUpdate(player);
|
||||
}
|
||||
|
||||
for(Table.Cell<Integer, String, Double> cell : GlobalTimingManager.INSTANCE.getStatsDim().cellSet()){
|
||||
System.out.printf("[ %4d ] %20s : %.3f µs\n", cell.getRowKey(), cell.getColumnKey(), cell.getValue());
|
||||
}
|
||||
|
||||
for(Table.Cell<Integer, String, Double> cell : GlobalTimingManager.INSTANCE.getStatsDimPerSection().cellSet()){
|
||||
System.out.printf("[ %4d ] %20s : %.3f µs\n", cell.getRowKey(), cell.getColumnKey(), cell.getValue());
|
||||
}
|
||||
|
||||
for(String key : NetworkProfiler.INSTANCE.stats.keySet()){
|
||||
System.out.printf("[ %s ] : %.3f µs\n", key, NetworkProfiler.INSTANCE.stats.get(key).getGeometricMean());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user