mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-22 13:09:53 +00:00
Added ProfilerTileEntity based on ProfilerSection.
Made most of the timing data sent as a DataTiming. Fixed total timing errors.
This commit is contained in:
1 parent
853674f829
commit
3c93af6e1f
20 files changed
+228
-233
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package mcp.mobius.opis.data.profilers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ProfilerTileEntityUpdate extends ProfilerAbstract {
|
||||
|
||||
private Clock clock = new Clock();
|
||||
public HashMap<CoordinatesBlock, DescriptiveStatistics> data = new HashMap<CoordinatesBlock, DescriptiveStatistics>();
|
||||
public HashMap<CoordinatesBlock, Class> refs = new HashMap<CoordinatesBlock, Class>();
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.data.clear();
|
||||
this.refs.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Object key) {
|
||||
TileEntity tileent = (TileEntity)key;
|
||||
if (tileent.getWorldObj().isRemote) return;
|
||||
|
||||
CoordinatesBlock coord = new CoordinatesBlock(tileent);
|
||||
|
||||
if (!data.containsKey(coord) || (refs.get(coord) != tileent.getClass())){
|
||||
data.put(coord, new DescriptiveStatistics());
|
||||
refs.put(coord, tileent.getClass());
|
||||
}
|
||||
clock.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Object key) {
|
||||
TileEntity tileent = (TileEntity)key;
|
||||
if (tileent.getWorldObj().isRemote) return;
|
||||
|
||||
clock.stop();
|
||||
CoordinatesBlock coord = new CoordinatesBlock(tileent);
|
||||
|
||||
data.get(coord).addValue((double)clock.timeDelta);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user