mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-26 15:03:07 +00:00
Reinjected the Summary panel and rehooked all the displays.
This commit is contained in:
1 parent
436bf07c6c
commit
6b88b569a4
5 files changed
+170
-585
No files matched your search
@@ -54,19 +54,6 @@ public class DataCache {
|
||||
private ArrayList<StatsChunk> timingChunks = new ArrayList<StatsChunk>();
|
||||
private ArrayList<StatsPlayer> listPlayers = new ArrayList<StatsPlayer>();
|
||||
|
||||
private double timingHandlersTotal = 0D;
|
||||
private double timingEntitiesTotal = 0D;
|
||||
private double timingTileEntsTotal = 0D;
|
||||
private double timingWorldTickTotal= 0D;
|
||||
private double timingEntUpdateTotal= 0D;
|
||||
|
||||
private int amountHandlersTotal = 0;
|
||||
private int amountEntitiesTotal = 0;
|
||||
private int amountTileEntsTotal = 0;
|
||||
|
||||
private long amountUpload = 0;
|
||||
private long amountDownload = 0;
|
||||
|
||||
private long clockScrew = 0;
|
||||
|
||||
private AccessLevel clientAccess = AccessLevel.NONE;
|
||||
@@ -100,106 +87,6 @@ public class DataCache {
|
||||
return this.clockScrew;
|
||||
}
|
||||
|
||||
public void setAmountUpload(long value){
|
||||
this.amountUpload = value;
|
||||
double uploadKB = (value / 8.0) / 1024.0;
|
||||
SwingUI.instance().getLblSummaryUpload().setText(String.format("%.3f", uploadKB));
|
||||
}
|
||||
|
||||
public void setAmountDownload(long value){
|
||||
this.amountDownload = value;
|
||||
double downloadKB = (value / 8.0) / 1024.0;
|
||||
SwingUI.instance().getLblSummaryDownload().setText(String.format("%.3f", downloadKB));
|
||||
}
|
||||
|
||||
private double getProfiledTickTotalTime(){
|
||||
return (timingWorldTickTotal + this.timingHandlersTotal + timingTileEntsTotal + timingEntitiesTotal)/1000.;
|
||||
}
|
||||
|
||||
public void setTimingEntUpdateTotal(double value){
|
||||
this.timingEntUpdateTotal = value;
|
||||
//SwingUI.instance().getLblSummaryTimingGlobalUpdate().setText(String.format("%.3f", value/1000.));
|
||||
//SwingUI.instance().getLblSummaryTimingTotal().setText(String.format("%.3f", this.getProfiledTickTotalTime() ));
|
||||
}
|
||||
|
||||
public void setTimingWorldTickTotal(double value){
|
||||
this.timingWorldTickTotal = value;
|
||||
SwingUI.instance().getLblSummaryTimingWorldTick().setText(String.format("%.3f", value/1000.));
|
||||
SwingUI.instance().getLblSummaryTimingTotal().setText(String.format("%.3f", this.getProfiledTickTotalTime() ));
|
||||
}
|
||||
|
||||
public void setTimingHandlersTotal(double value){
|
||||
this.timingHandlersTotal = value;
|
||||
SwingUI.instance().getLblSummaryTimingHandlers().setText(String.format("%.3f", value/1000.));
|
||||
SwingUI.instance().getPanelTimingHandlers().getLblSummary().setText(String.format("Total update time : %.3f µs", value));
|
||||
SwingUI.instance().getLblSummaryTimingTotal().setText(String.format("%.3f",this.getProfiledTickTotalTime()));
|
||||
}
|
||||
public void setTimingEntitiesTotal(double value){
|
||||
this.timingEntitiesTotal = value;
|
||||
SwingUI.instance().getLblSummaryTimingEntities().setText(String.format("%.3f", value/1000.));
|
||||
SwingUI.instance().getPanelTimingEntities().getLblSummary().setText(String.format("Total update time : %.3f µs", value));
|
||||
SwingUI.instance().getLblSummaryTimingTotal().setText(String.format("%.3f",this.getProfiledTickTotalTime()));
|
||||
}
|
||||
public void setTimingTileEntsTotal(double value){
|
||||
this.timingTileEntsTotal = value;
|
||||
SwingUI.instance().getLblSummaryTimingTileEnts().setText(String.format("%.3f", value/1000.));
|
||||
SwingUI.instance().getPanelTimingTileEnts().getLblSummary().setText(String.format("Total update time : %.3f µs", value));
|
||||
SwingUI.instance().getLblSummaryTimingTotal().setText(String.format("%.3f",this.getProfiledTickTotalTime()));
|
||||
}
|
||||
|
||||
public void setAmountHandlersTotal(int value){
|
||||
this.amountHandlersTotal = value;
|
||||
SwingUI.instance().getLblSummaryAmountHandlers().setText(String.valueOf(value));
|
||||
}
|
||||
public void setAmountEntitiesTotal(int value){
|
||||
this.amountEntitiesTotal = value;
|
||||
SwingUI.instance().getLblSummaryAmountEntities().setText(String.valueOf(value));
|
||||
}
|
||||
public void setAmountTileEntsTotal(int value){
|
||||
this.amountTileEntsTotal = value;
|
||||
SwingUI.instance().getLblSummaryAmountTileEnts().setText(String.valueOf(value));
|
||||
}
|
||||
|
||||
public void setTimingTick(ISerializable tickStat){
|
||||
this.timingTick = (StatsTick)tickStat;
|
||||
SwingUI.instance().getLblSummaryTimingTick().setText(String.valueOf(String.format("%.3f", this.timingTick.getGeometricMean()/1000.)));
|
||||
|
||||
if (timingTickGraphData.size() > 100)
|
||||
timingTickGraphData.remove(0);
|
||||
|
||||
timingTickGraphData.add(this.timingTick.getGeometricMean()/1000.);
|
||||
//timingTickGraphData.addValue(this.timingTick.getGeometricMean()/1000.);
|
||||
|
||||
XYSeries xyData = new XYSeries("Update time");
|
||||
|
||||
double maxValue = 0D;
|
||||
for (int i = 0; i < timingTickGraphData.size(); i++){
|
||||
xyData.add(i, timingTickGraphData.get(i));
|
||||
}
|
||||
|
||||
XYSeriesCollection dataset = new XYSeriesCollection();
|
||||
dataset.addSeries(xyData);
|
||||
|
||||
JFreeChart chart = ChartFactory.createXYAreaChart("", "Seconds", "Update Time [ms]", dataset, PlotOrientation.VERTICAL, false, false, false);
|
||||
chart.setBackgroundPaint(new Color(255,255,255,0));
|
||||
XYPlot xyPlot = chart.getXYPlot();
|
||||
xyPlot.getRendererForDataset(dataset).setSeriesPaint(0, Color.BLUE);
|
||||
|
||||
for (double y = 25.0; y < 250.0; y += 25.0){
|
||||
ValueMarker marker = new ValueMarker(y);
|
||||
marker.setPaint(Color.black);
|
||||
xyPlot.addRangeMarker(marker);
|
||||
}
|
||||
|
||||
Double verticalScale = 50.0 * (MathHelper.floor_double(xyData.getMaxY() / 50.0D) + 1);
|
||||
((NumberAxis)xyPlot.getRangeAxis()).setRange(0.0, verticalScale);
|
||||
|
||||
Dimension dim = SwingUI.instance().getLblSummaryTickChart().getSize();
|
||||
|
||||
BufferedImage image = chart.createBufferedImage(dim.width,dim.height);
|
||||
SwingUI.instance().getLblSummaryTickChart().setIcon(new ImageIcon(image));
|
||||
}
|
||||
|
||||
public ArrayList<AmountHolder> getAmountEntities(){
|
||||
return this.amountEntities;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user