Lag bar now shows target TPS from /tick command

This commit is contained in:
Marc Baloup 2024-03-03 18:32:29 +01:00
parent 5d294ea172
commit 1c22518dd9
1 changed files with 14 additions and 8 deletions

View File

@ -347,19 +347,19 @@ public class PerformanceAnalysisManager implements Listener {
: (avgTickDuration1s < 46) ? NamedTextColor.GOLD : (avgTickDuration1s < 46) ? NamedTextColor.GOLD
: NamedTextColor.RED; : NamedTextColor.RED;
timings = text("(Tr:") timings = text("(R/W/S:")
.then(text(Math.round(avgTickCPUTime1s) + "ms").color(avgTickCPUTime1sColor)) .then(text(Math.round(avgTickCPUTime1s)).color(avgTickCPUTime1sColor))
.thenText(" Tw:") .thenText("/")
.then(text(Math.round(avgTickWaitingTime1s) + "ms").color(avgTickWaitingTime1sColor)) .then(text(Math.round(avgTickWaitingTime1s)).color(avgTickWaitingTime1sColor))
.thenText(" S:") .thenText("/")
.then(text(Math.round(avgInterTickDuration1s) + "ms").color(avgInterTickDuration1sColor)) .then(text(Math.round(avgInterTickDuration1s)).color(avgInterTickDuration1sColor))
.thenText(")"); .thenText("ms)");
} }
title = infoText("TPS [") title = infoText("TPS [")
.thenLegacyText(s.toString()) .thenLegacyText(s.toString())
.thenText("] ") .thenText("] ")
.then(text(tps1sDisplay+"/20 ").color(tps1sGradient.pickColorAt(tps1s))) .then(text(tps1sDisplay + "/" + getTargetTickRate() + " ").color(tps1sGradient.pickColorAt(tps1s)))
.then(timings); .then(timings);
} }
@ -445,6 +445,12 @@ public class PerformanceAnalysisManager implements Listener {
return history; return history;
} }
public static int getTargetTickRate() {
return Math.round(Bukkit.getServerTickManager().getTickRate());
}