Package org.jpos.util
Class TPS
- java.lang.Object
-
- org.jpos.util.TPS
-
- All Implemented Interfaces:
Loggeable
public class TPS extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description protected long
simulatedNanoTime
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump(java.io.PrintStream p, java.lang.String indent)
float
floatValue()
float
getAvg()
long
getElapsed()
protected long
getNanoTime()
int
getPeak()
long
getPeakWhen()
long
getPeriod()
int
intValue()
void
reset()
resets average and peakvoid
setSimulatedNanoTime(long simulatedNanoTime)
void
stop()
void
tick()
java.lang.String
toString()
-
-
-
Field Detail
-
simulatedNanoTime
protected long simulatedNanoTime
-
-
Method Detail
-
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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
stop
public void stop()
-
dump
public void dump(java.io.PrintStream p, java.lang.String indent)
-
setSimulatedNanoTime
public void setSimulatedNanoTime(long simulatedNanoTime)
-
getNanoTime
protected long getNanoTime()
-
-