MCPcopy Create free account
hub / github.com/LFYSec/MScan / runAndCount

Method runAndCount

src/main/java/pascal/taie/util/Timer.java:84–93  ·  view source on GitHub ↗

Runs a task, log the elapsed time, and return the result. @param task task to be executed @param taskName name of the task

(Supplier<T> task, String taskName, Level level)

Source from the content-addressed store, hash-verified

82 * @param taskName name of the task
83 */
84 public static <T> T runAndCount(Supplier<T> task, String taskName, Level level) {
85 logger.info("{} starts ...", taskName);
86 Timer timer = new Timer(taskName);
87 timer.start();
88 T result = task.get();
89 timer.stop();
90 logger.log(level, "{} finishes, elapsed time: {}", taskName,
91 String.format("%.2fs", timer.inSecond()));
92 return result;
93 }
94
95 /**
96 * Runs a task and log the elapsed time.

Callers 10

mainMethod · 0.95
mainMethod · 0.95
buildWorldMethod · 0.95
executeMethod · 0.95
analyzeMethod · 0.95
onFinishMethod · 0.95
onFinishMethod · 0.95
ZipperMethod · 0.95
buildHeapModelMethod · 0.95

Calls 6

startMethod · 0.95
stopMethod · 0.95
inSecondMethod · 0.95
formatMethod · 0.80
getMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected