public class TimingImpl extends java.lang.Object implements java.io.Serializable, Jsonable
Timing
interface.Modifier and Type | Method and Description |
---|---|
void |
addChild(io.jdev.miniprofiler.internal.TimingInternal child) |
Profiler |
addChildProfiler(java.lang.String name)
Adds a child profiler under this step
|
void |
addCustomTiming(java.lang.String type,
java.lang.String executeType,
java.lang.String command,
long duration)
Add a custom timing to this timing.
|
void |
close()
Same as calling
Timing.stop() . |
CustomTiming |
customTiming(java.lang.String type,
java.lang.String executeType,
java.lang.String command)
Starts a custom timing under this timing.
|
<T> T |
customTiming(java.lang.String type,
java.lang.String executeType,
java.lang.String command,
java.util.concurrent.Callable<T> function)
Start and stop a new custom timing with the given callable function.
|
void |
customTiming(java.lang.String type,
java.lang.String executeType,
java.lang.String command,
java.lang.Runnable block)
Start and stop a new custom timing with the given block.
|
java.util.List<Profiler> |
getChildProfilers()
Returns child profilers of this timing
|
java.util.List<Timing> |
getChildren()
Returns all child timings of this timing
|
java.util.Map<java.lang.String,java.util.List<CustomTiming>> |
getCustomTimings()
Returns custom timings
|
int |
getDepth()
How many hops from the root timing
|
java.lang.Long |
getDurationMilliseconds()
Returned the length of this timing event
|
java.lang.String |
getName()
Returns the name of the timing
|
Timing |
getParent()
Returns the parent timing of this one.
|
ProfilerImpl |
getProfiler() |
long |
getStartMilliseconds()
Returns the start time of this timing in ms since profiler start
|
void |
setName(java.lang.String name)
Allows changing the name of the timing step after creation.
|
void |
stop()
Stops the timing step.
|
java.util.Map<java.lang.String,java.lang.Object> |
toMap() |
public void stop()
Timing
public void addChild(io.jdev.miniprofiler.internal.TimingInternal child)
public void addCustomTiming(java.lang.String type, java.lang.String executeType, java.lang.String command, long duration)
Timing
type
- type of timing, e.g. "sql"executeType
- what type of execution, e.g. "query"command
- e.g. "select * from foo"duration
- how long the command tookpublic CustomTiming customTiming(java.lang.String type, java.lang.String executeType, java.lang.String command)
Timing
The custom timing will not have a duration until CustomTiming.stop()
is called on the returned object.
type
- type of timing, e.g. "sql"executeType
- what type of execution, e.g. "query"command
- e.g. "select * from foo"public void customTiming(java.lang.String type, java.lang.String executeType, java.lang.String command, java.lang.Runnable block)
Timing
type
- type of timing, e.g. "sql"executeType
- what type of execution, e.g. "query"command
- e.g. "select * from foo"block
- the code to runpublic <T> T customTiming(java.lang.String type, java.lang.String executeType, java.lang.String command, java.util.concurrent.Callable<T> function) throws java.lang.Exception
Timing
T
- the return type of the functiontype
- type of timing, e.g. "sql"executeType
- what type of execution, e.g. "query"command
- e.g. "select * from foo"function
- The function to timejava.lang.Exception
- when the function throws an exceptionpublic java.util.Map<java.lang.String,java.lang.Object> toMap()
public java.lang.String getName()
Timing
public void setName(java.lang.String name)
Timing
name
- new name of the timing steppublic java.lang.Long getDurationMilliseconds()
Timing
Timing.stop()
method
was never calledpublic long getStartMilliseconds()
Timing
public java.util.List<Timing> getChildren()
Timing
public java.util.Map<java.lang.String,java.util.List<CustomTiming>> getCustomTimings()
Timing
public ProfilerImpl getProfiler()
public Timing getParent()
Timing
public int getDepth()
Timing
public void close()
Timing
Timing.stop()
.
Here to satisfy Closeable
and mark the method as not throwing a checked exception.
public Profiler addChildProfiler(java.lang.String name)
Timing
name
- the name of the profiler