org.jpos.util
Class TPS
java.lang.Object
org.jpos.util.TPS
- All Implemented Interfaces:
- Loggeable
public class TPS
- extends Object
- implements Loggeable
TPS can be used to measure Transactions Per Second (or transactions during other period of time).
It can operate in two different modes:
- Auto update
- Manual update
When operating in auto update mode, a Timer is created and the number of transactions (calls to tick())
is automatically calculated for every period. Under this mode, user has to call the
stop() method when this TPS object is no longer needed, otherwise it will keep a Thread
lingering around.
When operating in manual update mode, user has to call one of its
floatValue() or intValue() method at regular intervals. The returned value will be the average
TPS for the given period since the last call
.
- Since:
- 1.6.7 r2912
- Author:
- Alejandro Revilla, Jeronimo Paolleti and Thiago Moretto
|
Constructor Summary |
TPS()
|
TPS(boolean autoupdate)
|
TPS(long period,
boolean autoupdate)
|
TPS
public TPS()
TPS
public TPS(boolean autoupdate)
- Parameters:
autoupdate -
TPS
public TPS(long period,
boolean autoupdate)
- Parameters:
period - in millis
tick
public void tick()
floatValue
public float floatValue()
intValue
public int intValue()
getAvg
public float getAvg()
getPeak
public int getPeak()
getPeakWhen
public long getPeakWhen()
reset
public void reset()
- resets average and peak
getPeriod
public long getPeriod()
getElapsed
public long getElapsed()
toString
public String toString()
- Overrides:
toString in class Object
stop
public void stop()
dump
public void dump(PrintStream p,
String indent)
- Specified by:
dump in interface Loggeable
Copyright © 1998-2012 jPOS.org. All Rights Reserved.