From 9e839b561e7b7cd098d00880cb63487a51260807 Mon Sep 17 00:00:00 2001 From: asofold Date: Mon, 31 Dec 2012 16:22:46 +0100 Subject: [PATCH] Alter lag spike display to show spikes for intervals. --- .../nocheatplus/command/admin/LagCommand.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/admin/LagCommand.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/admin/LagCommand.java index 495af1dc..dde3b725 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/admin/LagCommand.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/command/admin/LagCommand.java @@ -29,20 +29,28 @@ public class LagCommand extends NCPCommand { int p = Math.max(0, (int) ((lag - 1.0) * 100.0)); builder.append(" " + p + "%[" + CheckUtils.fdec1.format((double) ms / 1200.0) + "s]" ); } - builder.append("\nLast hour spikes:\n| "); long[] spikeDurations = TickTask.getLagSpikeDurations(); int[] spikes = TickTask.getLagSpikes(); + builder.append("\nLast hour spikes (" + spikes[0] + " total, all > " + spikeDurations[0] + " ms):\n| "); if (spikes[0] > 0){ for (int i = 0; i < spikeDurations.length; i++){ if (i < spikeDurations.length - 1 && spikes[i] == spikes[i + 1]){ // Ignore these, get printed later. continue; } - builder.append((spikes[i] > 0 ? (spikes[i]) : "none") + " > " + spikeDurations[i] + " ms | "); + if (spikes[i] == 0){ + builder.append("none |"); + } + else if (i < spikeDurations.length - 1){ + builder.append((spikes[i] - spikes[i + 1]) + "x" + spikeDurations[i] + "..." + spikeDurations[i + 1] + " | "); + } + else{ + builder.append(spikes[i] + "x" + spikeDurations[i] +"... | "); + } } } else{ - builder.append("none > " + spikeDurations[0] + " ms |"); + builder.append("none | "); } sender.sendMessage(builder.toString()); return true;