public class StopWatch extends Object implements Settings
Modifier and Type | Class and Description |
---|---|
static class |
StopWatch.TimeType
Type of measurement for time.
|
Constructor and Description |
---|
StopWatch(int maxAttempts)
Constructs and initializes the watch from the max number
of times the watch will be stopped.
|
Modifier and Type | Method and Description |
---|---|
double |
getAverageMs()
Returns the average time in ms in the set of timings.
|
ListLong |
getNanoAverages(int start)
Gets the average of all sets of timings after the first
start timings. |
ListLong |
getNanoTimings()
Returns a copy of the set of times
|
Object[] |
getOutput()
List of headers for the data members.
|
StopWatch.TimeType |
getTimeType()
Gets the type of time used by the watch.
|
String[] |
getTitle()
List of headers for the data members.
|
long |
getTotalMs()
Returns the total time in ms in the set of timings.
|
void |
setTimeType(StopWatch.TimeType type)
Sets the utility used to measure time changes.
|
void |
start()
Starts the watch.
|
void |
stop()
Stops the watch.
|
public StopWatch(int maxAttempts)
stop
more than the
number of maxAttempts
.maxAttempts
- max number of times that will be trackedpublic void start()
start
more than the max
number of attempts set in the constructor.public void stop()
stop
more than the max
number of attempts set in the constructor.
This is NOT verified in the method call as to improve efficiency.public double getAverageMs()
public long getTotalMs()
public ListLong getNanoTimings()
public ListLong getNanoAverages(int start)
start
timings.
Inclusive of timings[start]
and inclusive of timings[MAX]
.
Example:
timings = [5 10 15 20 25]
start = 2
timings[start] = 15
averages[0] = 15 / 1
averages[1] = (15 + 20) / 2
averages[2] = (15 + 20 + 25) / 2start
- starting index of timingspublic StopWatch.TimeType getTimeType()
public void setTimeType(StopWatch.TimeType type)
type
- type of time (system or cpu)public String[] getTitle()
Settings
Copyright © 2015. All rights reserved.