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 Link icon

    • NanoTimer Link icon

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

    • start Link icon

      public void start()
      Start the timer
    • Stop Link icon

      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 Link icon

      public long getMeanTime()
      Mean time over n calls if setRunningCount(n) was previously called.
      Returns:
      mean time over n calls to start() / stop().
    • setRuningCount Link icon

      public void setRuningCount(int nRunningCounts)
      Set the number of calls to make average measurements over.
      Parameters:
      iRuningCount - the iRuningCount to set
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object