Hi Frédéric, Sorry for getting back to you so late. I was busy with logging. :)
I've just added the four throughput getter methods you suggested to IoService. I am not sure these properties are needed in the IoSession level. Please let me know what you think. And, the problem that readMessages remains 0 has been fixed. Sorry for wasting your time. :-( Any additional feed back is appreciated. :) Cheers, Trustin On Dec 14, 2007 4:32 AM, Frédéric Brégier <[EMAIL PROTECTED]> wrote: > Hi Trustin and all Mina fans, > > Well, I come back with a proposal of addition in IoHandler. > Doing this will prevent me to use a specific Timer to do the same. > The objective are to get some statistics value on long term, > whatever the sessions are still running or not. > I think that only throughput are relevant, since others could be problematic > (risk of overflow) and could be not so relevant in general way. > Here is the proposal : > > //NEW FIELDS > private double largestReadBytesThroughput = 0.0; > private double largestWrittenBytesThroughput = 0.0; > private double largestReadMessagesThroughput = 0.0; > private double largestWrittenMessagesThroughput = 0.0; > > private void updateThroughput(long currentTime) { > synchronized (throughputCalculationLock) { > int interval = (int) (currentTime - > lastThroughputCalculationTime); > long minInterval = getThroughputCalculationIntervalInMillis(); > if (minInterval == 0 || interval < minInterval) { > return; > } > > long readBytes = this.readBytes.get(); > long writtenBytes = this.writtenBytes.get(); > long readMessages = this.readMessages.get(); > long writtenMessages = this.writtenMessages.get(); > > readBytesThroughput = (readBytes - lastReadBytes) * 1000.0 / > interval; > writtenBytesThroughput = (writtenBytes - lastWrittenBytes) * > 1000.0 / interval; > readMessagesThroughput = (readMessages - lastReadMessages) * > 1000.0 / interval; > writtenMessagesThroughput = (writtenMessages - > lastWrittenMessages) * 1000.0 / interval; > > // NEW FIELDS FOR LARGEST VALUES WHATEVER THE LIFE OF SESSIONS > if (readBytesThroughput > largestReadBytesThroughput) > largestReadBytesThroughput = readBytesThroughput; > if (writtenBytesThroughput > largestWrittenBytesThroughput) > largestWrittenBytesThroughput = writtenBytesThroughput; > if (readMessagesThroughput > largestReadMessagesThroughput) > largestReadMessagesThroughput = readMessagesThroughput; > if (writtenMessagesThroughput > largestWrittenMessagesThroughput) > largestWrittenMessagesThroughput = writtenMessagesThroughput; > // END OF ADDON > > lastReadBytes = readBytes; > lastWrittenBytes = writtenBytes; > lastReadMessages = readMessages; > lastWrittenMessages = writtenMessages; > > lastThroughputCalculationTime = currentTime; > } > } > // NEW METHODS > public final double getLargestReadBytesThroughput() { > return largestReadBytesThroughput; > } > public final double getLargestWrittenBytesThroughput() { > return largestWrittenBytesThroughput; > } > public final double getLargestReadMessagesThroughput() { > return largestReadMessagesThroughput; > } > public final double getLargestWrittenMessagesThroughput() { > return largestWrittenMessagesThroughput; > } > Could it be something added to Mina ? > > Also I really don't know why Read Messages (max throughput or cumulative) > are still 0 in my code, but should not be since bytes are not null as below. > Is this relative to the use of DemuxingIoHandler ? WDYT ? > I look at the code and see nothing particular that should produce this > behaviour. > > Active since: Wed Dec 12 17:23:57 CET 2007 > Cumulative Sessions: 106 > Maximum Concurrent Sessions: 106 > Current Active Sessions: 106 > Bytes read by Second: 113200.9900990099 > Messages read by Second: 0.0 > Cumulative Read Messages: 0 > Bytes written by Second: 5700083.168316832 > Messages written by Second: 1079.8679867986798 > Cumulative Written Messages: 51780 > > Frederic > > -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6