aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko/spark/common/command
diff options
context:
space:
mode:
authorAndrew Steinborn <andrew@steinborn.me>2020-05-26 05:49:58 -0400
committerGitHub <noreply@github.com>2020-05-26 10:49:58 +0100
commitd993703e9b52651d456e7eceb691f90228b2cd5e (patch)
tree3f3c3450cb69818c1ea7edec552e92a44884a4b3 /spark-common/src/main/java/me/lucko/spark/common/command
parent0f207b3c44c701d42ac1bb828f5c967e2de73568 (diff)
downloadspark-d993703e9b52651d456e7eceb691f90228b2cd5e.tar.gz
spark-d993703e9b52651d456e7eceb691f90228b2cd5e.tar.bz2
spark-d993703e9b52651d456e7eceb691f90228b2cd5e.zip
Add 95th percentile MSPT and replace average MSPT with median MSPT (#55)
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/command')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/command/modules/HealthModule.java18
1 files changed, 10 insertions, 8 deletions
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<Command> 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();
}