public static <T> TimedResult<T> measureIf(final boolean isTimed, final Supplier<T> resultSupplier) {
        if (isTimed) {
            final Instant startTime = Instant.now();
            final T result = resultSupplier.get();
            return new TimedResult<>(Duration.between(startTime, Instant.now()), result);
        } else {
            return TimedResult.zero(resultSupplier.get());
        }
    }
Measures the time taken to perform resultSupplier if isTimed is true.
If isTimed is false returns a {@link TimedResult} containing a zero duration.
stroom-util/src/main/java/stroom/util/logging/DurationTimer.java