Convert average tick value in the GUI to the correct granularity

This commit is contained in:
Shane Freeder 2024-01-24 16:27:32 +00:00
parent 8dae5500dd
commit 49feea0525
2 changed files with 3 additions and 3 deletions

View file

@ -23,9 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms");
vector.add("Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double) TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms");
+ vector.add("TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg));
+
setListData(vector);
}

View file

@ -164,6 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import net.minecraft.Util;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.TimeUtil;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListSelectionModel;
@ -221,7 +222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Vector<String> vector = new Vector<>();
+ vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
+ vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double) TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms");
+ setListData(vector);
+ }
+