reformat code
[yosql.git] / yosql-codegen / src / main / java / wtf / metio / yosql / codegen / orchestration / Timer.java
bloba6193bcceff9198e2be273ad5197f82eea8a0495
1 /*
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
5 * in the LICENSE file.
6 */
8 package wtf.metio.yosql.codegen.orchestration;
10 import java.util.function.Supplier;
12 /**
13 * Utility class to time how long certain executions take.
15 public interface Timer {
17 /**
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);
25 /**
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);
34 /**
35 * Prints the previously recorded timings and clear them.
37 void printTimings();