Package pascal.taie.util
Class Timer
java.lang.Object
pascal.taie.util.Timer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
float
inSecond()
static void
runAndCount
(Runnable task, String taskName) Runs a task and log the elapsed time.static void
runAndCount
(Runnable task, String taskName, org.apache.logging.log4j.Level level) 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.static void
runWithTimeout
(Runnable task, long seconds) Runs a task with given time budget.void
start()
void
stop()
toString()
-
Constructor Details
-
Timer
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
inSecond
public float inSecond() -
clear
public void clear() -
toString
-
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 executedtaskName
- name of the task
-
runAndCount
Runs a task and log the elapsed time.- Parameters:
task
- task to be executedtaskName
- taskName of the task
-
runAndCount
-
runWithTimeout
Runs a task with given time budget.
-