From 49feea052590150281ec26419548556a8e1a536f Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 24 Jan 2024 16:27:32 +0000 Subject: [PATCH] Convert average tick value in the GUI to the correct granularity --- patches/server/Improve-ServerGUI.patch | 3 +-- patches/server/Make-the-GUI-graph-fancier.patch | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch index 94ed7d4059..8645d9e11a 100644 --- a/patches/server/Improve-ServerGUI.patch +++ b/patches/server/Improve-ServerGUI.patch @@ -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); } diff --git a/patches/server/Make-the-GUI-graph-fancier.patch b/patches/server/Make-the-GUI-graph-fancier.patch index 542f3f7d54..d3e5a828db 100644 --- a/patches/server/Make-the-GUI-graph-fancier.patch +++ b/patches/server/Make-the-GUI-graph-fancier.patch @@ -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 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); + } +