Class Timer

java.lang.Object
com.sun.speech.freetts.util.Timer

public class Timer extends Object
Keeps track of execution times.
  • Constructor Details

    • Timer

      public Timer(String name)
      Creates a timer.
      Parameters:
      name - the name of the timer
  • Method Details

    • reset

      public void reset()
      Resets the timer as if it has never run before.
    • start

      public void start()
      Starts the timer running.
    • getCurrentTime

      public long getCurrentTime()
      Returns the current time.
      Returns:
      the current time
    • stop

      public void stop(boolean verbose)
      Stops the timer.
      Parameters:
      verbose - if true, print out details from this run; otherwise, don't print the details
    • stop

      public void stop()
      Stops the timer.
    • showTimesLong

      public void showTimesLong(long overall)
      Shows detailed timing stats. If overall is non-zero, it represents the overall processing time and a percentage of overall time for this timer should be calculated and displayed.
      Parameters:
      overall - the overall processing time in milliseconds or 0.
    • showTimesShortTitle

      public static void showTimesShortTitle(String title)
      Shows the timing stats title.
      Parameters:
      title - shows the title and column headings for the time display
    • showTimesShort

      public void showTimesShort(long overall)
      Shows brief timing stats. If overall is non-zero, it represents the overall processing time and a percentage of overall time for this timer should be calculated and displayed.
      Parameters:
      overall - the overall processing time in milliseconds or 0.
    • showTimes

      public void showTimes(long overall)
      Shows timing stats. If overall is non-zero, it represents the overall processing time and a percentage of overall time for this timer should be calculated and displayed.
      Parameters:
      overall - the overall processing time in milliseconds or 0.
    • showTimes

      public void showTimes()
      Shows timing stats. No overall percentage is shown with this method.
    • main

      public static void main(String[] args)
      The main program for performing simple tests. Creates a timer uses it and shows its output.
      Parameters:
      args - program arguments (not used)