From d993703e9b52651d456e7eceb691f90228b2cd5e Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 26 May 2020 05:49:58 -0400 Subject: Add 95th percentile MSPT and replace average MSPT with median MSPT (#55) --- .../spark/common/command/modules/HealthModule.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'spark-common/src/main/java/me/lucko/spark/common/command') diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java index 08233db..64c2fba 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java @@ -48,6 +48,8 @@ import java.util.function.Consumer; public class HealthModule implements CommandModule { + private static final int MSPT_95_PERCENTILE = 95; + @Override public void registerCommands(Consumer consumer) { consumer.accept(Command.builder() @@ -67,10 +69,9 @@ public class HealthModule implements CommandModule { resp.replyPrefixed(TextComponent.empty()); if (tickStatistics.isDurationSupported()) { - resp.replyPrefixed(TextComponent.of("Tick durations (avg/min/max ms) from last 5s, 10s, 1m:")); + resp.replyPrefixed(TextComponent.of("Tick durations (min/med/95%ile/max ms) from last 10s, 1m:")); resp.replyPrefixed(TextComponent.builder(" ") - .append(formatTickDurations(tickStatistics.duration5Sec())).append(TextComponent.of(", ")) - .append(formatTickDurations(tickStatistics.duration10Sec())).append(TextComponent.of(", ")) + .append(formatTickDurations(tickStatistics.duration10Sec())).append(TextComponent.of("; ")) .append(formatTickDurations(tickStatistics.duration1Min())) .build() ); @@ -129,12 +130,11 @@ public class HealthModule implements CommandModule { report.add(TextComponent.builder("") .append(TextComponent.builder(">").color(TextColor.DARK_GRAY).decoration(TextDecoration.BOLD, true).build()) .append(TextComponent.space()) - .append(TextComponent.of("Tick durations (avg/min/max ms) from last 5s, 10s, 1m:", TextColor.GOLD)) + .append(TextComponent.of("Tick durations (min/med/95%ile/max ms) from last 10s, 1m:", TextColor.GOLD)) .build() ); report.add(TextComponent.builder(" ") - .append(formatTickDurations(tickStatistics.duration5Sec())).append(TextComponent.of(", ")) - .append(formatTickDurations(tickStatistics.duration10Sec())).append(TextComponent.of(", ")) + .append(formatTickDurations(tickStatistics.duration10Sec())).append(TextComponent.of("; ")) .append(formatTickDurations(tickStatistics.duration1Min())) .build() ); @@ -299,10 +299,12 @@ public class HealthModule implements CommandModule { public static TextComponent formatTickDurations(RollingAverage average){ return TextComponent.builder("") - .append(formatTickDuration(average.getAverage())) - .append(TextComponent.of('/', TextColor.GRAY)) .append(formatTickDuration(average.getMin())) .append(TextComponent.of('/', TextColor.GRAY)) + .append(formatTickDuration(average.getMedian())) + .append(TextComponent.of('/', TextColor.GRAY)) + .append(formatTickDuration(average.getPercentile(MSPT_95_PERCENTILE))) + .append(TextComponent.of('/', TextColor.GRAY)) .append(formatTickDuration(average.getMax())) .build(); } -- cgit