More statly bits.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3067 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-08-04 02:36:56 +00:00
parent 6b0695af30
commit a924387ffb
2 changed files with 24 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: ConMgrStats.java,v 1.1 2004/08/04 02:31:18 mdb Exp $
// $Id: ConMgrStats.java,v 1.2 2004/08/04 02:36:56 mdb Exp $
package com.threerings.presents.data;
@@ -13,6 +13,12 @@ public class ConMgrStats implements Streamable
/** The current index into the history arrays. */
public int current;
/** The size of the queue of waiting to auth sockets. */
public int[] authQueueSize;
/** The size of the queue of waiting to die sockets. */
public int[] deathQueueSize;
/** The outgoing queue size. */
public int[] outQueueSize;
@@ -36,6 +42,8 @@ public class ConMgrStats implements Streamable
public void increment ()
{
current++;
authQueueSize[current] = 0;
deathQueueSize[current] = 0;
outQueueSize[current] = 0;
overQueueSize[current] = 0;
bytesIn[current] = 0;
@@ -1,5 +1,5 @@
//
// $Id: ConnectionManager.java,v 1.40 2004/08/04 02:31:18 mdb Exp $
// $Id: ConnectionManager.java,v 1.41 2004/08/04 02:36:56 mdb Exp $
package com.threerings.presents.server.net;
@@ -102,9 +102,23 @@ public class ConnectionManager extends LoopingThread
/**
* Returns our current runtime statistics. When the stats are fetched
* the counters are rolled to the next bucket. 60 buckets are tracked.
* <em>Note:</em> don't call this method <em>too</em> frequently (more
* often than once every few seconds or so) as it has to total things
* up and run a number of synchronized methods.
*/
public synchronized ConMgrStats getStats ()
{
// fill in our snapshot values
_stats.authQueueSize[_stats.current] = _authq.size();
_stats.deathQueueSize[_stats.current] = _deathq.size();
_stats.outQueueSize[_stats.current] = _outq.size();
if (_oflowqs.size() > 0) {
Iterator oqiter = _oflowqs.values().iterator();
while (oqiter.hasNext()) {
OverflowQueue oq = (OverflowQueue)oqiter.next();
_stats.overQueueSize[_stats.current] += oq.size();
}
}
_stats.increment();
return _stats;
}