Package PamUtils

Class NanoTimer

java.lang.Object
PamUtils.NanoTimer

public class NanoTimer extends Object
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 Details

    • NanoTimer

      public NanoTimer(String timerName)
      Parameters:
      timerName - Name for the timer
  • Method Details

    • start

      public void start()
      Start the timer
    • Stop

      public long Stop(PrintStream os)
      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

      public String toString()
      Overrides:
      toString in class Object