public class MiniProfiler
extends java.lang.Object
If your code does not use dependency injection, use this class instead
of a ProfilerProvider
instance when you need to start a new
profiling session or add a new step.
By default, this class will internally create a DefaultProfilerProvider
instance to forward calls to. If you wish to change the profiler provider used,
call setProfilerProvider(ProfilerProvider)
with your preferred implementation.
Even if you are using dependency injection, it's probably good practice to
set it statically here using setProfilerProvider(ProfilerProvider)
so that any code that can't get injected can still make timing calls. An example
might be instrumented code.
Constructor and Description |
---|
MiniProfiler() |
Modifier and Type | Method and Description |
---|---|
static Profiler |
current()
Returns the profiler object for the current profiling session.
|
static Profiler |
getCurrent()
A properties-friendly version of
current() . |
static ProfilerProvider |
getProfilerProvider()
Return the current internal profiler provider.
|
static Storage |
getStorage()
Returns the storage associated with the current profiler provider.
|
static java.lang.String |
getVersion()
Returns the current version of the MiniProfiler-JVM library
|
static void |
setProfilerProvider(ProfilerProvider profilerProvider)
Set the profiler provider instance to use for static calls
|
static Profiler |
start(java.lang.String rootName)
Start a new profiling session with the default
ProfileLevel.Info level. |
static Profiler |
start(java.lang.String rootName,
ProfileLevel level)
Start a new profiling session with the given level.
|
public static ProfilerProvider getProfilerProvider()
public static void setProfilerProvider(ProfilerProvider profilerProvider)
profilerProvider
- the instance to usepublic static Profiler current()
public static Profiler getCurrent()
current()
.public static Profiler start(java.lang.String rootName)
ProfileLevel.Info
level.rootName
- the name of the root timing step to create. This would often be the URI of the current request.public static Profiler start(java.lang.String rootName, ProfileLevel level)
rootName
- the name of the root timing step to create. This would often be the URI of the current request.level
- the level of logging to dopublic static Storage getStorage()
public static java.lang.String getVersion()