public final class Profiler
extends java.lang.Object
implements java.lang.AutoCloseable
A time interval is measured from the creation of the object to its closing.
It implements AutoCloseable and can be used in conjunction with a
try-with-resource statement to measure the amount of time totalTime from
entering to exiting the try block.
| Modifier and Type | Class and Description |
|---|---|
static class |
Profiler.Elapsed
A class that encapsulate the interval measured by a
Profiler
object. |
static interface |
Profiler.OutputDelegate
A functional interface that represents the action to output the measured
interval (for compatibility with < 1.8)
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static Profiler |
start(Profiler.Elapsed elapsed)
Returns a new instance of the
Profiler class. |
static Profiler |
start(Profiler.Elapsed elapsed,
long threshold)
Returns a new instance of the
Profiler class. |
static Profiler |
start(Profiler.OutputDelegate writeCallback)
Returns a new instance of the
Profiler class. |
static Profiler |
start(Profiler.OutputDelegate writeCallback,
long threshold)
Returns a new instance of the
Profiler class. |
static Profiler |
start(java.lang.String message)
Returns a new instance of the
Profiler class. |
static Profiler |
start(java.lang.String message,
long threshold)
Returns a new instance of the
Profiler class. |
static Profiler |
start(java.lang.String message,
Profiler.OutputDelegate writeCallback)
Returns a new instance of the
Profiler class. |
static Profiler |
start(java.lang.String message,
Profiler.OutputDelegate writeCallback,
long threshold)
Returns a new instance of the
Profiler class. |
public static Profiler start(java.lang.String message, Profiler.OutputDelegate writeCallback)
Profiler class.message - The message associated to the perf totalTime.writeCallback - The callback that will be invoked to log the results of the
totalTime.public static Profiler start(java.lang.String message, Profiler.OutputDelegate writeCallback, long threshold)
Profiler class.message - The message associated to the perf totalTime.writeCallback - The callback that will be invoked to log the results of the
totalTime.threshold - If the elapsed time is greater or equal to that threshold
value (in ms) the message is logged otherwise it isn't.public static Profiler start(java.lang.String message)
Profiler class.message - The message associated to the perf totalTime.public static Profiler start(java.lang.String message, long threshold)
Profiler class.message - The message associated to the perf totalTime.threshold - If the elapsed time is greater or equal to that threshold
value (in ms) the message is logged otherwise it isn't.public static Profiler start(Profiler.OutputDelegate writeCallback)
Profiler class.writeCallback - The callback that will be invoked to log the results of the
totalTime.public static Profiler start(Profiler.OutputDelegate writeCallback, long threshold)
Profiler class.writeCallback - The callback that will be invoked to log the results of the
totalTime.threshold - If the elapsed time is greater or equal to that threshold
value (in ms) the message is logged otherwise it isn't.public static Profiler start(Profiler.Elapsed elapsed)
Profiler class.elapsed - A Elapsed object that will be used to store the results of the
totalTime.public static Profiler start(Profiler.Elapsed elapsed, long threshold)
Profiler class.elapsed - A Elapsed object that will be used to store the results of the
totalTime.threshold - If the elapsed time is greater or equal to that threshold
value (in ms) the message is logged otherwise it isn't.public void close()
close in interface java.lang.AutoCloseableCopyright © 2018 Frederic Thevenet. All rights reserved.