Async-profiler: Hot Spots Tabular visualizations

Created on 6 Dec 2018  路  4Comments  路  Source: jvm-profiling-tools/async-profiler

HI guys,

after talked with a couple of collagues I've received an interesting feedback and a question:
"async-profiler does support tabular visualizations that help to individuate the hot spots/methods where most of the time is spent, regardless which stacktrace they belong?".
I've to be honest that I personally prefer the flamegraph visualization, but I admit that there are cases where having the old-school tabular view could help to start an investigation.
Do you think it worths to add such output? It is already present and I simply ignore its existence?

Thanks,
Franz

Most helpful comment

Async-profiler supports tabular hot spot format (aka "flat profile") out-of-the-box.
Use -o flat:

          ns  percent  samples  top
  ----------  -------  -------  ---
  1375787484   17.54%      130  oopDesc* PSPromotionManager::copy_to_survivor_space<false>(oopDesc*)
  1223035489   15.60%      114  InstanceKlass::oop_push_contents(PSPromotionManager*, oopDesc*)
   841774712   10.73%       82  java.util.HashMap$Node.<init>
   716278280    9.13%       64  PSPromotionManager::drain_stacks_depth(bool)
   676282093    8.62%       66  java.util.HashMap.putVal
   519183567    6.62%       47  StealTask::do_it(GCTaskManager*, unsigned int)
   388019385    4.95%       36  PSPromotionManager::process_array_chunk(oopDesc*)
   322150159    4.11%       32  java.io.BufferedReader.readLine
   237891372    3.03%       24  CardTableExtension::scavenge_contents_parallel(ObjectStartArray*, MutableSpace*, HeapWord*, PSPromotionManager*, unsigned int, unsigned int)
   212313830    2.71%       20  GenericTaskQueue<StarTask, (MemoryType)1, 131072u>::pop_global(StarTask volatile&)
   208469661    2.66%       21  ObjArrayKlass::oop_push_contents(PSPromotionManager*, oopDesc*)
   169328160    2.16%       17  java.util.Arrays.copyOfRange
   167152438    2.13%       14  OverflowTaskQueue<StarTask, (MemoryType)1, 131072u>::push(StarTask)
   110112075    1.40%       11  InstanceKlass::vtable_length() const
    74003440    0.94%        8  jshort_disjoint_arraycopy
    47545576    0.61%        4  sun.nio.cs.UTF_8$Decoder.decodeArrayLoop
    44004487    0.56%        4  java.lang.String.<init>
    43400438    0.55%        4  java.lang.String.substring
    40974884    0.52%        4  java.lang.CharacterData.of
    39085716    0.50%        3  __memmove_ssse3_back
    31112639    0.40%        3  SpinPause
    30656236    0.39%        3  java.lang.Long.parseLong

Furthermore, you can get an interactive flat profile in HTML format with the expandable backtraces.
Try -o tree --reverse -f backtrace.html:

Backtrace view

And finally, as @nitsanw said, it's pretty easy to get the desired view from collapsed format.

All 4 comments

The collapsed stacks format is now imported from both IDEA and speedscope, both offer flamegraph and tabular forms. In addition, getting top methods from the collapsed stacks is easily done via CLI, e.g.:

cat myprofile.collapsed | awk '{ fNum = split(substr($0,0,length($0)-length($NF)),frames,";"); a[frames[fNum]] += $NF } END { for (i in a) { printf "%-15s\t%s\n", a[i], i; } }' | sort -g -r | head -n 20

Will give you the top 20 methods.

Async-profiler supports tabular hot spot format (aka "flat profile") out-of-the-box.
Use -o flat:

          ns  percent  samples  top
  ----------  -------  -------  ---
  1375787484   17.54%      130  oopDesc* PSPromotionManager::copy_to_survivor_space<false>(oopDesc*)
  1223035489   15.60%      114  InstanceKlass::oop_push_contents(PSPromotionManager*, oopDesc*)
   841774712   10.73%       82  java.util.HashMap$Node.<init>
   716278280    9.13%       64  PSPromotionManager::drain_stacks_depth(bool)
   676282093    8.62%       66  java.util.HashMap.putVal
   519183567    6.62%       47  StealTask::do_it(GCTaskManager*, unsigned int)
   388019385    4.95%       36  PSPromotionManager::process_array_chunk(oopDesc*)
   322150159    4.11%       32  java.io.BufferedReader.readLine
   237891372    3.03%       24  CardTableExtension::scavenge_contents_parallel(ObjectStartArray*, MutableSpace*, HeapWord*, PSPromotionManager*, unsigned int, unsigned int)
   212313830    2.71%       20  GenericTaskQueue<StarTask, (MemoryType)1, 131072u>::pop_global(StarTask volatile&)
   208469661    2.66%       21  ObjArrayKlass::oop_push_contents(PSPromotionManager*, oopDesc*)
   169328160    2.16%       17  java.util.Arrays.copyOfRange
   167152438    2.13%       14  OverflowTaskQueue<StarTask, (MemoryType)1, 131072u>::push(StarTask)
   110112075    1.40%       11  InstanceKlass::vtable_length() const
    74003440    0.94%        8  jshort_disjoint_arraycopy
    47545576    0.61%        4  sun.nio.cs.UTF_8$Decoder.decodeArrayLoop
    44004487    0.56%        4  java.lang.String.<init>
    43400438    0.55%        4  java.lang.String.substring
    40974884    0.52%        4  java.lang.CharacterData.of
    39085716    0.50%        3  __memmove_ssse3_back
    31112639    0.40%        3  SpinPause
    30656236    0.39%        3  java.lang.Long.parseLong

Furthermore, you can get an interactive flat profile in HTML format with the expandable backtraces.
Try -o tree --reverse -f backtrace.html:

Backtrace view

And finally, as @nitsanw said, it's pretty easy to get the desired view from collapsed format.

Many thanks guys!! Super fast response! You're low latency devs eheh

Thank you so much!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ceeaspb picture ceeaspb  路  6Comments

marshallpierce picture marshallpierce  路  6Comments

shipilev picture shipilev  路  4Comments

henryjcee picture henryjcee  路  5Comments

apangin picture apangin  路  5Comments