public class AutomaticProfiler
extends java.lang.Object
InstantProfiler
using a sample rate and a print rate. If the sampling rate is less than the print,
the Profiler will print the min, max and average values gathered in between two prints.
By default it will use the components timer and create one if non is found, a timer can be provided using the
function setTimer(Timer)
.
The profiler can compute the range from the start()
see (watchOverallRange()
; or/and in between two
print see watchIntervalRange()
.Constructor and Description |
---|
AutomaticProfiler(InstantProfiler profiler)
Instantiates a
AutomaticProfiler . |
Modifier and Type | Method and Description |
---|---|
int |
getPrintRate()
Gets the print rate.
|
Profiler |
getProfiler()
Gets the profiler.
|
int |
getSamplingRate()
Gets the sampling rate.
|
void |
print()
Prints the values sampled.
|
void |
reset()
Resets the profiling values.
|
void |
setLogLevel(java.util.logging.Level logLevel)
Sets the log level.
|
void |
setRates(int printRate,
int samplingRate)
Sets the print and sampling rates.
|
void |
setTimer(ej.bon.Timer timer)
Sets the timer used for the sampling.
|
void |
start()
Starts the profiling.
|
void |
stop()
Stops the profiling.
|
boolean |
watchIntervalRange()
Gets whether the profiler watches the range from the last call.
|
void |
watchIntervalRange(boolean interval)
Sets whether the profiler watches the range from the last call.
|
boolean |
watchOverallRange()
Gets whether the profiler watches the range from the start.
|
void |
watchOverallRange(boolean overall)
Sets whether the profiler watches the range from the start.
|
public AutomaticProfiler(InstantProfiler profiler)
AutomaticProfiler
.profiler
- the profiler to follow.public boolean watchOverallRange()
public void watchOverallRange(boolean overall)
overall
- whether the profiler watches the range from the start.public boolean watchIntervalRange()
public void watchIntervalRange(boolean interval)
interval
- whether the profiler watches the range from the last call.public void setLogLevel(java.util.logging.Level logLevel)
logLevel
- the level to use.public int getSamplingRate()
public int getPrintRate()
public void setRates(int printRate, int samplingRate)
The print rate is the frequency that the profiler will use to print the values.
The sampling rate is the frequency that the profiler will use to sample values.
It print rate be bigger or equals to the sampling rate.
printRate
- the printRate to set should be more than 0.samplingRate
- the samplingRate to set should be more than 0.java.lang.IllegalArgumentException
- when printRate ≤ 0 or samplingRate ≤ 0 or samplingRate > printRate.public void setTimer(ej.bon.Timer timer)
timer
- the timer to use.public void start()
public void stop()
public void reset()
public Profiler getProfiler()
public void print()