Package noaa.coastwatch.test
Class TimeAccumulator
java.lang.Object
noaa.coastwatch.test.TimeAccumulator
A
TimeAccumulator
object can be used for precise accumulation
of time used in a thread for performance testing.- Since:
- 3.4.0
- Author:
- Peter Hollemans
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(TimeAccumulator acc) Adds the time from another accumulator to this one.void
end()
Marks the end of a CPU time recording session and adds the accumulated time to the total.void
reset()
Resets the accumulated time.void
start()
Marks the start of a CPU time recording session.double
Gets the total time accumulated.
-
Constructor Details
-
TimeAccumulator
public TimeAccumulator()
-
-
Method Details
-
start
public void start()Marks the start of a CPU time recording session. -
end
public void end()Marks the end of a CPU time recording session and adds the accumulated time to the total. -
add
Adds the time from another accumulator to this one. This operation is thread safe.- Parameters:
acc
- the accumulator with time to add to this one.
-
totalSeconds
public double totalSeconds()Gets the total time accumulated.- Returns:
- the time accumulated in seconds.
-
reset
public void reset()Resets the accumulated time.
-