public class AsyncProfiler extends Object implements AsyncProfilerMXBean
getInstance() initiates loading of
libasyncProfiler.so.| Modifier and Type | Method and Description |
|---|---|
void |
addThread(Thread thread)
Add the given thread to the set of profiled threads.
|
String |
dumpCollapsed(Counter counter)
Dump profile in 'collapsed stacktraces' format
|
String |
dumpFlat(int maxMethods)
Dump flat profile, i.e.
|
String |
dumpTraces(int maxTraces)
Dump collected stack traces
|
String |
execute(String command)
Execute an agent-compatible profiling command -
the comma-separated list of arguments described in arguments.cpp
|
static AsyncProfiler |
getInstance() |
static AsyncProfiler |
getInstance(String libPath) |
long |
getSamples()
Get the number of samples collected during the profiling session
|
String |
getVersion()
Get profiler agent version, e.g.
|
void |
removeThread(Thread thread)
Remove the given thread from the set of profiled threads.
|
void |
resume(String event,
long interval)
Start or resume profiling without resetting collected data.
|
void |
start(String event,
long interval)
Start profiling
|
void |
stop()
Stop profiling (without dumping results)
|
public static AsyncProfiler getInstance()
public static AsyncProfiler getInstance(String libPath)
public void start(String event, long interval) throws IllegalStateException
start in interface AsyncProfilerMXBeanevent - Profiling event, see Eventsinterval - Sampling interval, e.g. nanoseconds for Events.CPUIllegalStateException - If profiler is already runningpublic void resume(String event, long interval) throws IllegalStateException
resume in interface AsyncProfilerMXBeanevent - Profiling event, see Eventsinterval - Sampling interval, e.g. nanoseconds for Events.CPUIllegalStateException - If profiler is already runningpublic void stop()
throws IllegalStateException
stop in interface AsyncProfilerMXBeanIllegalStateException - If profiler is not runningpublic long getSamples()
getSamples in interface AsyncProfilerMXBeanpublic String getVersion()
getVersion in interface AsyncProfilerMXBeanpublic String execute(String command) throws IllegalArgumentException, IOException
execute in interface AsyncProfilerMXBeancommand - Profiling commandIllegalArgumentException - If failed to parse the commandIOException - If failed to create output filepublic String dumpCollapsed(Counter counter)
dumpCollapsed in interface AsyncProfilerMXBeancounter - Which counter to display in the outputpublic String dumpTraces(int maxTraces)
dumpTraces in interface AsyncProfilerMXBeanmaxTraces - Maximum number of stack traces to dump. 0 means no limitpublic String dumpFlat(int maxMethods)
dumpFlat in interface AsyncProfilerMXBeanmaxMethods - Maximum number of methods to dump. 0 means no limitpublic void addThread(Thread thread)
thread - Thread to include in profilingpublic void removeThread(Thread thread)
thread - Thread to exclude from profilingCopyright © 2021. All rights reserved.