mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-18 11:29:28 +00:00
Adjusted Event profiler to handle the new package/class gathering.
This commit is contained in:
1 parent
1df4c4eb2f
commit
3daa42e5fa
4 files changed
+26
-12
No files matched your search
@@ -14,15 +14,26 @@ import mcp.mobius.opis.data.holders.ISerializable;
|
||||
public class DataEvent implements ISerializable, Comparable {
|
||||
public CachedString event;
|
||||
public CachedString handler;
|
||||
public CachedString package_;
|
||||
public DataTiming update;
|
||||
|
||||
public DataEvent fill(Cell<Class, Class, DescriptiveStatistics> cell){
|
||||
public DataEvent fill(Cell<Class, String, DescriptiveStatistics> cell){
|
||||
/*
|
||||
String handlerName = cell.getColumnKey().getSimpleName();
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e){}
|
||||
*/
|
||||
String[] nameRaw = cell.getColumnKey().split("\\|");
|
||||
|
||||
String handlerName = nameRaw[1];
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e){}
|
||||
|
||||
this.package_= new CachedString(nameRaw[0]);
|
||||
this.handler = new CachedString(handlerName);
|
||||
this.event = new CachedString(cell.getRowKey().getName().replace("net.minecraftforge.event.", ""));
|
||||
|
||||
@@ -33,6 +44,7 @@ public class DataEvent implements ISerializable, Comparable {
|
||||
@Override
|
||||
public void writeToStream(DataOutputStream stream) throws IOException {
|
||||
this.event.writeToStream(stream);
|
||||
this.package_.writeToStream(stream);
|
||||
this.handler.writeToStream(stream);
|
||||
this.update.writeToStream(stream);
|
||||
}
|
||||
@@ -40,6 +52,7 @@ public class DataEvent implements ISerializable, Comparable {
|
||||
public static DataEvent readFromStream(DataInputStream stream) throws IOException {
|
||||
DataEvent retVal = new DataEvent();
|
||||
retVal.event = CachedString.readFromStream(stream);
|
||||
retVal.package_= CachedString.readFromStream(stream);
|
||||
retVal.handler = CachedString.readFromStream(stream);
|
||||
retVal.update = DataTiming.readFromStream(stream);
|
||||
return retVal;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.google.common.collect.HashMultimap;
|
||||
public class ProfilerEvent extends ProfilerAbstract {
|
||||
|
||||
private Clock clock = new Clock();
|
||||
public HashBasedTable<Class, Class, DescriptiveStatistics> data = HashBasedTable.create();
|
||||
public HashBasedTable<Class, String, DescriptiveStatistics> data = HashBasedTable.create();
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
@@ -21,14 +21,16 @@ public class ProfilerEvent extends ProfilerAbstract {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Object key1, Object key2) {
|
||||
public void stop(Object key1, Object key2, Object key3) {
|
||||
clock.stop();
|
||||
|
||||
try{
|
||||
data.get(key1.getClass(), key2.getClass()).addValue((double)clock.timeDelta);
|
||||
String name = (String)key2 + "|" + key3.getClass().getSimpleName();
|
||||
data.get(key1.getClass(), name).addValue((double)clock.timeDelta);
|
||||
} catch (Exception e) {
|
||||
data.put(key1.getClass(), key2.getClass(), new DescriptiveStatistics(250));
|
||||
data.get(key1.getClass(), key2.getClass()).addValue((double)clock.timeDelta);
|
||||
String name = (String)key2 + "|" + key3.getClass().getSimpleName();
|
||||
data.put(key1.getClass(), name, new DescriptiveStatistics(250));
|
||||
data.get(key1.getClass(), name).addValue((double)clock.timeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,8 +220,8 @@ public class OpisPacketHandler implements IPacketHandler {
|
||||
DataBlockTick totalWorldTick = new DataBlockTick().fill();
|
||||
|
||||
ArrayList<DataEvent> timingEvents = new ArrayList<DataEvent>();
|
||||
HashBasedTable<Class, Class, DescriptiveStatistics> eventData = ((ProfilerEvent)ProfilerSection.EVENT_INVOKE.getProfiler()).data;
|
||||
for (Cell<Class, Class, DescriptiveStatistics> cell : eventData.cellSet()){
|
||||
HashBasedTable<Class, String, DescriptiveStatistics> eventData = ((ProfilerEvent)ProfilerSection.EVENT_INVOKE.getProfiler()).data;
|
||||
for (Cell<Class, String, DescriptiveStatistics> cell : eventData.cellSet()){
|
||||
timingEvents.add(new DataEvent().fill(cell));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,13 @@ public class PanelTimingEvents extends JPanelMsgHandler implements ITabPanel {
|
||||
table = new JTableStats();
|
||||
table.setModel(new DefaultTableModel(
|
||||
new Object[][] {
|
||||
{null, null, null},
|
||||
},
|
||||
new String[] {
|
||||
"Event", "Handler", "Timing"
|
||||
"Event", "Class", "Handler", "Timing"
|
||||
}
|
||||
) {
|
||||
Class[] columnTypes = new Class[] {
|
||||
String.class, String.class, DataTiming.class
|
||||
String.class, String.class, String.class, DataTiming.class
|
||||
};
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
return columnTypes[columnIndex];
|
||||
@@ -64,7 +63,7 @@ public class PanelTimingEvents extends JPanelMsgHandler implements ITabPanel {
|
||||
|
||||
for (Object o : rawdata.array){
|
||||
DataEvent data = (DataEvent)o;
|
||||
model.addRow(new Object[] {data.event, data.handler, data.update});
|
||||
model.addRow(new Object[] {data.event, data.package_, data.handler, data.update});
|
||||
}
|
||||
|
||||
this.dataUpdated(table, model, row);
|
||||
|
||||
Reference in new issue
Block a user