Usage: asprof [action] [options] <pid>
Actions:
start start profiling and return immediately
resume resume profiling without resetting collected data
stop stop profiling
dump dump collected data without stopping profiling session
status print profiling status
metrics print profiler metrics in Prometheus format
list list profiling events supported by the target JVM
load load agent library (jattach action)
jcmd run JVM diagnostic command (jattach action)
collect collect profile for the specified period of time
and then stop (default action)
Options:
-e event profiling event: cpu|alloc|nativemem|lock|cache-misses etc.
-d duration run profiling for <duration> seconds
-f filename file name or http(s) URL to submit profiles to
-i interval sampling interval in nanoseconds
-j jstackdepth maximum Java stack depth
-t, --threads profile different threads separately
-s, --simple simple class names instead of FQN
-n, --norm normalize names of hidden classes / lambdas
-g, --sig print method signatures
-a, --ann annotate Java methods
-l, --lib prepend library names
--dot dotted class names
-o fmt output format: flat|traces|collapsed|flamegraph|tree|jfr|otlp
-I include output only stack traces containing the specified pattern
-X exclude exclude stack traces with the specified pattern
-L level log level: debug|info|warn|error|none
-F features advanced stack trace features: mixed, vtable, comptask, pcaddr
-v, --version display version string
--title string FlameGraph title
--minwidth pct skip frames smaller than pct%
--reverse generate stack-reversed FlameGraph / Call tree (defaults to icicle graph)
--inverted toggles the layout for reversed stacktraces from icicle to flamegraph
and for default stacktraces from flamegraph to icicle
--loop time run profiler in a loop
--alloc bytes allocation profiling interval in bytes
--tlab use TLAB events for allocation profiling
--live build allocation profile from live objects only
--nativemem bytes native allocation profiling interval in bytes
--nofree do not collect free calls in native allocation profiling
--trace method Method to be instrumented with optional latency threshold
--lock time lock profiling threshold in nanoseconds
--nativelock time pthread mutex/rwlock profiling threshold in nanoseconds
--wall interval wall clock profiling interval
--nobatch legacy wall clock sampling without batch events
--ithread pattern in wall clock mode, profile only threads matching the name pattern
--xthread pattern in wall clock mode, skip threads matching the name pattern
--proc interval process sampling interval (default: 30s)
--all shorthand for enabling cpu, wall, alloc, live,
nativemem and lock profiling simultaneously
--total accumulate the total value (time, bytes, etc.)
--all-user only include user-mode events
--sched group threads by scheduling policy
--cstack mode how to traverse C stack: fp|dwarf|vm|no
--signal num use alternative signal for cpu or wall clock profiling
--clock source clock source for JFR timestamps: tsc|monotonic
--begin function begin profiling when function is executed
--end function end profiling when function is executed
--ttsp only time-to-safepoint profiling
--nostop do not stop profiling outside --begin/--end window
--memlimit bytes limit size of the stack trace storage
--ratelimit limits limit the number of JFR events emitted per second
--jfropts opts JFR recording options: mem
--jfrsync config synchronize profiler with JFR recording
--libpath path full path to libasyncProfiler.so in the container
--fdtransfer run separate fdtransfer process to serve perf requests
from the non-privileged target
--target-cpu cpu sample threads on a specific CPU (perf_events only, default: -1)
<pid> is a numeric process ID of the target JVM
or 'jps' keyword to find running JVM automatically
or the application name as it would appear in the jps tool
Example: asprof -d 30 -f profile.html 3456
asprof start -i 1ms jps
asprof stop -o flat jps
asprof -d 5 -e alloc MyAppName
asprof --all -f profile.jfr MyAppName
Options (54)
| Option | Description | Source |
|---|---|---|
-e event | profiling event: cpu|alloc|nativemem|lock|cache-misses etc. | help |
-d duration | run profiling for <duration> seconds | help |
-f filename | file name or http(s) URL to submit profiles to | help |
-i interval | sampling interval in nanoseconds | help |
-j jstackdepth | maximum Java stack depth | help |
-t, --threads | profile different threads separately | help |
-s, --simple | simple class names instead of FQN | help |
-n, --norm | normalize names of hidden classes / lambdas | help |
-g, --sig | print method signatures | help |
-a, --ann | annotate Java methods | help |
-l, --lib | prepend library names | help |
--dot | dotted class names | help |
-o fmt | output format: flat|traces|collapsed|flamegraph|tree|jfr|otlp | help |
-I include | output only stack traces containing the specified pattern | help |
-X exclude | exclude stack traces with the specified pattern | help |
-L level | log level: debug|info|warn|error|none | help |
-F features | advanced stack trace features: mixed, vtable, comptask, pcaddr | help |
-v, --version | display version string | help |
--title string | FlameGraph title | help |
--minwidth pct | skip frames smaller than pct% | help |
--reverse | generate stack-reversed FlameGraph / Call tree (defaults to icicle graph) | help |
--inverted | toggles the layout for reversed stacktraces from icicle to flamegraph and for default stacktraces from flamegraph to icicle | help |
--loop time | run profiler in a loop | help |
--alloc bytes | allocation profiling interval in bytes | help |
--tlab | use TLAB events for allocation profiling | help |
--live | build allocation profile from live objects only | help |
--nativemem bytes | native allocation profiling interval in bytes | help |
--nofree | do not collect free calls in native allocation profiling | help |
--trace method | Method to be instrumented with optional latency threshold | help |
--lock time | lock profiling threshold in nanoseconds | help |
--nativelock time | pthread mutex/rwlock profiling threshold in nanoseconds | help |
--wall interval | wall clock profiling interval | help |
--nobatch | legacy wall clock sampling without batch events | help |
--ithread pattern | in wall clock mode, profile only threads matching the name pattern | help |
--xthread pattern | in wall clock mode, skip threads matching the name pattern | help |
--proc interval | process sampling interval (default: 30s) | help |
--all | shorthand for enabling cpu, wall, alloc, live, nativemem and lock profiling simultaneously | help |
--total | accumulate the total value (time, bytes, etc.) | help |
--all-user | only include user-mode events | help |
--sched | group threads by scheduling policy | help |
--cstack mode | how to traverse C stack: fp|dwarf|vm|no | help |
--signal num | use alternative signal for cpu or wall clock profiling | help |
--clock source | clock source for JFR timestamps: tsc|monotonic | help |
--begin function | begin profiling when function is executed | help |
--end function | end profiling when function is executed | help |
--ttsp | only time-to-safepoint profiling | help |
--nostop | do not stop profiling outside --begin/--end window | help |
--memlimit bytes | limit size of the stack trace storage | help |
--ratelimit limits | limit the number of JFR events emitted per second | help |
--jfropts opts | JFR recording options: mem | help |
--jfrsync config | synchronize profiler with JFR recording | help |
--libpath path | full path to libasyncProfiler.so in the container | help |
--fdtransfer | run separate fdtransfer process to serve perf requests from the non-privileged target | help |
--target-cpu cpu | sample threads on a specific CPU (perf_events only, default: -1) | help |