I am trying to view list of profiling events supported by jvm. As mentioned in the doc I have used the list
command as shown below -
root@vrni-platform:/home/ubuntu/async-profiler-2.0-linux-x64# ./profiler.sh list 10208
Basic events:
cpu
alloc
lock
wall
itimer
Java method calls:
ClassName.methodName
Perf events:
page-faults
context-switches
cycles
instructions
cache-references
cache-misses
branches
branch-misses
bus-cycles
L1-dcache-load-misses
LLC-load-misses
dTLB-load-misses
mem:breakpoint
trace:tracepoint
I am not seeing the events as mentioned in this answer in the above output. But if I execute the above events as mentioned in that answer it seems to be working.
root@vrni-platform:/home/ubuntu/async-profiler-2.0-linux-x64# ./profiler.sh -e malloc -d 30 -f /tmp/flamegraph.html 10208
Profiling for 30 seconds
Done
Can someone let me know how can I view list of all events supported by aysnc-profiler for a particular jvm? If list
is the correct argument for profiler.sh
then why malloc, etc are shown under list of all events?
Environment
ubuntu@vrni-platform:~/async-profiler-2.0-linux-x64# ./profiler.sh --version
Async-profiler 2.0 built on Mar 14 2021
Copyright 2016-2021 Andrei Pangin
ubuntu@vrni-platform:~/async-profiler-2.0-linux-x64# uname -a
Linux vrni-platform 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@vrni-platform:~/async-profiler-2.0-linux-x64$ java -version
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment Zulu11.48+22-SA (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.48+22-SA (build 11.0.11+9-LTS, mixed mode)
malloc
here is not a separate event. It's just an example of an execution breakpoint.
async-profiler, with the assistance of the hardware breakpoints, can trace access to any memory location. Using the perf-like syntax for hardware breakpoints, you can choose to profile the execution of any given address in the code:
./profiler.sh -e mem:0x123450:x <pid>
Instead of the numerical address, it's possible to specify a native function name. malloc
is just a name of the function in the standard C library (libc):
./profiler.sh -e mem:malloc:x <pid>
And -e malloc
is a shortcut for the above event descriptor. If async-profiler finds that the given event name corresponds to some native function, it profiles the execution of this function.
Instead of malloc
, you can profile any other function as well. For example,
-e pthread_start
to find who starts new threads (both Java and native threads);-e connect
to profile new socket connections;-e JVM_GC
to find callers of System.gc()
;-e G1CollectedHeap::humongous_obj_allocate
to profile G1 humongous allocations;-e Deoptimization::uncommon_trap
to find where the compiled code is deoptimized;and so on, and so forth. There are thousands of native functions in the JVM, in the standard class library, in libc. Obviously, it's not practically possible to list them all in async-profiler help.