Class OPSMeter
java.lang.Object
com.wualabs.qtsurfer.common.util.OPSMeter
Lightweight operations-per-second meter. Call
count() on each operation; the meter
reports a smoothed current rate via getOps() and the lifetime operation count
via getProcessed().
The rate is an exponential moving average of the instantaneous per-operation rate (the
reciprocal of the interval since the previous operation), so it tracks recent throughput and
decays as activity slows. This is deliberately not the lifetime average
processed / totalElapsed, which barely moves once many operations have accumulated and
therefore never reflects a current slowdown or burst.
All mutating and reading methods are synchronized: count() is invoked from multiple
delivery threads on the market-data fan-in paths (per-instrument ticker/order-book streams feed
a shared meter), where an unsynchronized processed++ silently loses increments.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
OPSMeter
-
-
Method Details
-
reset
public void reset() -
count
public void count()Records one operation and updates the smoothed current rate. The first call (or the first afterreset()) only establishes the timing baseline. Subsequent calls fold the instantaneous rate for the elapsed interval into the moving average; operations landing within the same nanosecond (concurrent delivery) still count but do not perturb the rate. -
getProcessed
public long getProcessed() -
getOps
public float getOps() -
toString
-
getName
-