From b88b142bd3cecb44fb778d5b3a5b2d3ac158440f Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 25 Jun 2006 23:23:23 +0000 Subject: [PATCH] Added mostRecent() as that's the one we want to display rather than current which is currently accumulating on the server and always zero on the client. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4224 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/data/ConMgrStats.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/java/com/threerings/presents/data/ConMgrStats.java b/src/java/com/threerings/presents/data/ConMgrStats.java index 1c37a807e..b8dead9a8 100644 --- a/src/java/com/threerings/presents/data/ConMgrStats.java +++ b/src/java/com/threerings/presents/data/ConMgrStats.java @@ -58,14 +58,14 @@ public class ConMgrStats extends SimpleStreamableObject /** Creates our historical arrays. */ public void init () { - authQueueSize = new int[60]; - deathQueueSize = new int[60]; - outQueueSize = new int[60]; - overQueueSize = new int[60]; - bytesIn = new int[60]; - bytesOut = new int[60]; - msgsIn = new int[60]; - msgsOut = new int[60]; + authQueueSize = new int[SLOTS]; + deathQueueSize = new int[SLOTS]; + outQueueSize = new int[SLOTS]; + overQueueSize = new int[SLOTS]; + bytesIn = new int[SLOTS]; + bytesOut = new int[SLOTS]; + msgsIn = new int[SLOTS]; + msgsOut = new int[SLOTS]; } /** Advances the currently accumulating bucket and clears its @@ -82,4 +82,14 @@ public class ConMgrStats extends SimpleStreamableObject msgsIn[current] = 0; msgsOut[current] = 0; } + + /** + * Returns the index of the most recently accumulated stats slot. + */ + public int mostRecent () + { + return (current + SLOTS - 1) % SLOTS; + } + + protected static final int SLOTS = 60; }