Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: add helpers to wrap lambdas with a timer (#1087)
Adds helpers to the Timer interface to wrap the common lambda types in `java.util.function`. This can be useful to wrap a lambda that is passed to another class in order to measure each invocation. For example: ```java Timer t = registry.timer(id); int sum = Arrays .stream(new String[] {"foo", "bar", "baz"}) .mapToInt(t.wrapToIntFunction(String::length)) .sum(); ``` Caller should ensure that the lambda does sufficient work that timing an invocatino will not be more costly than executing the lambda body.
- Loading branch information