Package org.apache.mina.core.service
Class IoServiceStatistics
- java.lang.Object
-
- org.apache.mina.core.service.IoServiceStatistics
-
public class IoServiceStatistics extends Object
Provides usage statistics for anAbstractIoServiceinstance.- Since:
- 2.0.0-M3
- Author:
- Apache MINA Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIoServiceStatistics.ConfigThis is a configuration for IoServiceStatistics.
-
Constructor Summary
Constructors Constructor Description IoServiceStatistics(IoService service)Creates a new IoServiceStatistics instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecreaseScheduledWriteMessages()Decrements the count of messages scheduled for write.IoServiceStatistics.ConfiggetConfig()longgetCumulativeManagedSessionCount()intgetLargestManagedSessionCount()doublegetLargestReadBytesThroughput()doublegetLargestReadMessagesThroughput()doublegetLargestWrittenBytesThroughput()doublegetLargestWrittenMessagesThroughput()longgetLastIoTime()longgetLastReadTime()longgetLastWriteTime()longgetReadBytes()doublegetReadBytesThroughput()longgetReadMessages()doublegetReadMessagesThroughput()intgetScheduledWriteBytes()intgetScheduledWriteMessages()intgetThroughputCalculationInterval()longgetThroughputCalculationIntervalInMillis()longgetWrittenBytes()doublegetWrittenBytesThroughput()longgetWrittenMessages()doublegetWrittenMessagesThroughput()voidincreaseReadBytes(long nbBytesRead, long currentTime)Increases the count of read bytes bynbBytesReadand sets the last read time tocurrentTime.voidincreaseReadMessages(long currentTime)Increases the count of read messages by 1 and sets the last read time tocurrentTime.voidincreaseScheduledWriteBytes(int increment)Increments byincrementthe count of bytes scheduled for write.voidincreaseScheduledWriteMessages()Increments the count of messages scheduled for write.voidincreaseWrittenBytes(int nbBytesWritten, long currentTime)Increases the count of written bytes bynbBytesWrittenand sets the last write time tocurrentTime.voidincreaseWrittenMessages(long currentTime)Increases the count of written messages by 1 and sets the last write time tocurrentTime.protected voidsetLastReadTime(long lastReadTime)Sets last time at which a read occurred on the service.protected voidsetLastThroughputCalculationTime(long lastThroughputCalculationTime)Sets the time at which throughput counters where updated.protected voidsetLastWriteTime(long lastWriteTime)Sets last time at which a write occurred on the service.voidsetThroughputCalculationInterval(int throughputCalculationInterval)Sets the interval (seconds) between each throughput calculation.voidupdateThroughput(long currentTime)Updates the throughput counters.
-
-
-
Method Detail
-
getLargestManagedSessionCount
public final int getLargestManagedSessionCount()
- Returns:
- The maximum number of sessions which were being managed at the same time.
-
getCumulativeManagedSessionCount
public final long getCumulativeManagedSessionCount()
- Returns:
- The cumulative number of sessions which were managed (or are being managed) by this service, which means 'currently managed session count + closed session count'.
-
getLastIoTime
public final long getLastIoTime()
- Returns:
- the time in millis when the last I/O operation (read or write) occurred.
-
getLastReadTime
public final long getLastReadTime()
- Returns:
- The time in millis when the last read operation occurred.
-
getLastWriteTime
public final long getLastWriteTime()
- Returns:
- The time in millis when the last write operation occurred.
-
getReadBytes
public final long getReadBytes()
- Returns:
- The number of bytes this service has read so far
-
getWrittenBytes
public final long getWrittenBytes()
- Returns:
- The number of bytes this service has written so far
-
getReadMessages
public final long getReadMessages()
- Returns:
- The number of messages this services has read so far
-
getWrittenMessages
public final long getWrittenMessages()
- Returns:
- The number of messages this service has written so far
-
getReadBytesThroughput
public final double getReadBytesThroughput()
- Returns:
- The number of read bytes per second.
-
getWrittenBytesThroughput
public final double getWrittenBytesThroughput()
- Returns:
- The number of written bytes per second.
-
getReadMessagesThroughput
public final double getReadMessagesThroughput()
- Returns:
- The number of read messages per second.
-
getWrittenMessagesThroughput
public final double getWrittenMessagesThroughput()
- Returns:
- The number of written messages per second.
-
getLargestReadBytesThroughput
public final double getLargestReadBytesThroughput()
- Returns:
- The maximum number of bytes read per second since the service has been started.
-
getLargestWrittenBytesThroughput
public final double getLargestWrittenBytesThroughput()
- Returns:
- The maximum number of bytes written per second since the service has been started.
-
getLargestReadMessagesThroughput
public final double getLargestReadMessagesThroughput()
- Returns:
- The maximum number of messages read per second since the service has been started.
-
getLargestWrittenMessagesThroughput
public final double getLargestWrittenMessagesThroughput()
- Returns:
- The maximum number of messages written per second since the service has been started.
-
getThroughputCalculationInterval
public final int getThroughputCalculationInterval()
- Returns:
- the interval (seconds) between each throughput calculation. The
default value is
3seconds.
-
getThroughputCalculationIntervalInMillis
public final long getThroughputCalculationIntervalInMillis()
- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3seconds.
-
setThroughputCalculationInterval
public final void setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation. The default value is3seconds.- Parameters:
throughputCalculationInterval- The interval between two calculation
-
setLastReadTime
protected final void setLastReadTime(long lastReadTime)
Sets last time at which a read occurred on the service.- Parameters:
lastReadTime- The last time a read has occurred
-
setLastWriteTime
protected final void setLastWriteTime(long lastWriteTime)
Sets last time at which a write occurred on the service.- Parameters:
lastWriteTime- The last time a write has occurred
-
updateThroughput
public void updateThroughput(long currentTime)
Updates the throughput counters.- Parameters:
currentTime- The current time
-
increaseReadBytes
public final void increaseReadBytes(long nbBytesRead, long currentTime)Increases the count of read bytes bynbBytesReadand sets the last read time tocurrentTime.- Parameters:
nbBytesRead- The number of bytes readcurrentTime- The date those bytes were read
-
increaseReadMessages
public final void increaseReadMessages(long currentTime)
Increases the count of read messages by 1 and sets the last read time tocurrentTime.- Parameters:
currentTime- The time the message has been read
-
increaseWrittenBytes
public final void increaseWrittenBytes(int nbBytesWritten, long currentTime)Increases the count of written bytes bynbBytesWrittenand sets the last write time tocurrentTime.- Parameters:
nbBytesWritten- The number of bytes writtencurrentTime- The date those bytes were written
-
increaseWrittenMessages
public final void increaseWrittenMessages(long currentTime)
Increases the count of written messages by 1 and sets the last write time tocurrentTime.- Parameters:
currentTime- The date the message were written
-
getScheduledWriteBytes
public final int getScheduledWriteBytes()
- Returns:
- The count of bytes scheduled for write.
-
increaseScheduledWriteBytes
public final void increaseScheduledWriteBytes(int increment)
Increments byincrementthe count of bytes scheduled for write.- Parameters:
increment- The number of added bytes fro write
-
getScheduledWriteMessages
public final int getScheduledWriteMessages()
- Returns:
- the count of messages scheduled for write.
-
increaseScheduledWriteMessages
public final void increaseScheduledWriteMessages()
Increments the count of messages scheduled for write.
-
decreaseScheduledWriteMessages
public final void decreaseScheduledWriteMessages()
Decrements the count of messages scheduled for write.
-
setLastThroughputCalculationTime
protected void setLastThroughputCalculationTime(long lastThroughputCalculationTime)
Sets the time at which throughput counters where updated.- Parameters:
lastThroughputCalculationTime- The time at which throughput counters where updated.
-
getConfig
public final IoServiceStatistics.Config getConfig()
- Returns:
- The configuration of IoServiceStatistics
-
-