Package PamUtils
Class NanoTimer
java.lang.Object
PamUtils.NanoTimer
Utility to measure execution times of various parts of PAMGuard.
All based on nanosecond times from the system clock so does not
really represent CPU usage of individual threads.
- Author:
- dg50
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Mean time over n calls if setRunningCount(n) was previously called.void
setRuningCount
(int nRunningCounts) Set the number of calls to make average measurements over.void
start()
Start the timerlong
Stop
(PrintStream os) Stop the timertoString()
-
Constructor Details
-
NanoTimer
- Parameters:
timerName
- Name for the timer
-
-
Method Details
-
start
public void start()Start the timer -
Stop
Stop the timer- Parameters:
os
- name of a print stream if you want quick terminal output (e.g. System.out)- Returns:
- time in nanos since start() was called.
-
getMeanTime
public long getMeanTime()Mean time over n calls if setRunningCount(n) was previously called.- Returns:
- mean time over n calls to start() / stop().
-
setRuningCount
public void setRuningCount(int nRunningCounts) Set the number of calls to make average measurements over.- Parameters:
iRuningCount
- the iRuningCount to set
-
toString
-