public class PerformanceTimer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
PerformanceTimer.PerformanceSample
Records information about an interval of time as a performance sample.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name
The name of this
PerformanceTimer |
protected java.util.Deque<PerformanceTimer.PerformanceSample> |
samples
Timer samples (time intervals)
|
Constructor and Description |
---|
PerformanceTimer()
Create a new nameless PerformanceTimer.
|
PerformanceTimer(java.lang.String name)
Create a named PerformanceTimer.
|
Modifier and Type | Method and Description |
---|---|
double |
getLastResult()
Retrieves the last timing result, in miliseconds.
|
java.util.List<PerformanceTimer.PerformanceSample> |
getSamples()
Get all the samples recorded by this PerformanceTimer so far.
|
int |
size()
Retrieves the number of samples recorded by this PerformanceTimer
instance.
|
void |
start()
Starts a time interval.
|
void |
stop()
Stops the currently-running time interval.
|
void |
stopAndPrint()
Stops the currently-running time interval and prints its duration.
|
java.lang.String |
toString() |
protected java.lang.String name
PerformanceTimer
protected java.util.Deque<PerformanceTimer.PerformanceSample> samples
public PerformanceTimer()
public PerformanceTimer(java.lang.String name)
public void start()
public void stop()
public void stopAndPrint()
public java.util.List<PerformanceTimer.PerformanceSample> getSamples()
public double getLastResult()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object