2 * This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at https://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
8 package wtf
.metio
.yosql
.codegen
.orchestration
;
10 import java
.util
.function
.Supplier
;
13 * Utility class to time how long certain executions take.
15 public interface Timer
{
18 * Measures the execution time of a single runnable task.
20 * @param taskName The name of the task to run.
21 * @param task The task to run.
23 void timed(String taskName
, Runnable task
);
26 * Measures the execution time of a single supplier.
28 * @param taskName The name of the task to run.
29 * @param supplier The supplier to execute.
30 * @return The value provided by the supplier.
32 <T
> T
timed(String taskName
, Supplier
<T
> supplier
);
35 * Prints the previously recorded timings and clear them.