Class Timer

java.lang.Object
pascal.taie.util.Timer

public class Timer extends Object
  • Constructor Details

    • Timer

      public Timer(String name)
  • Method Details

    • start

      public void start()
    • stop

      public void stop()
    • inSecond

      public float inSecond()
    • clear

      public void clear()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • runAndCount

      public static <T> T runAndCount(Supplier<T> task, String taskName, org.apache.logging.log4j.Level level)
      Runs a task, log the elapsed time, and return the result.
      Parameters:
      task - task to be executed
      taskName - name of the task
    • runAndCount

      public static void runAndCount(Runnable task, String taskName)
      Runs a task and log the elapsed time.
      Parameters:
      task - task to be executed
      taskName - taskName of the task
    • runAndCount

      public static void runAndCount(Runnable task, String taskName, org.apache.logging.log4j.Level level)
    • runWithTimeout

      public static void runWithTimeout(Runnable task, long seconds)
      Runs a task with given time budget.