Using perfasm profiler

Aleksey Shipilev aleksey.shipilev at gmail.com
Mon Apr 12 06:32:27 UTC 2021


Hi,

Your message was not accepted by this mailing list, because there is a 3.5 MB attachment; use a 
hosted service next time?

On 4/8/21 11:23 AM, Marius Jokubauskas wrote:
> Hi there,
> 
> I'm trying to run my JMH benchmark with perfasm profiler, had no luck
> neither on Windows nor Linux machine.
> 
> On a Linux:
> 
> ```
> 
> Secondary result
> "com.gocypher.cybench.jmh.jvm.client.tests.StringBenchmarks.findRegexCompiled:·asm":
> PrintAssembly processed: 113690 total address lines.
> Perf output processed (skipped 0.000 seconds):
>    Column 1: cycles (0 events)
> 
> ```
> 
> I have saved the output with "savePerf" and lokked up
> LinuxPerfAsmProfiler.java - seems it's expecting "cycles" events and my
> `perf` output has none
> 
> ```
> 
> <..>
> 
> 75897.832892: cpu-clock:      7f88a3ea23af _dl_lookup_symbol_x
> (/usr/lib/x86_64-linux-gnu/ld-2.32.so)
> 75897.833894: cpu-clock:  ffffffff8da879e1 do_user_addr_fault
> ([kernel.kallsyms])
> 75897.835496: cpu-clock:      7f88a3d0ee0b _IO_getc
> (/usr/lib/x86_64-linux-gnu/libc-2.32.so)
> 75897.836900: cpu-clock:  ffffffff8da879e1 do_user_addr_fault
> ([kernel.kallsyms])
> 75897.840843: cpu-clock:  ffffffff8e5cc9f5 __lock_text_start
> ([kernel.kallsyms])
> 75897.845748: cpu-clock:      7f88a3cfb93e __vfprintf_internal
> (/usr/lib/x86_64-linux-gnu/libc-2.32.so)
> 75897.851575: cpu-clock:  ffffffff8dc5feae mark_page_accessed
> ([kernel.kallsyms])
> 75897.854370: cpu-clock:  ffffffff8e5cc9f5 __lock_text_start
> ([kernel.kallsyms])
> 75897.859151: cpu-clock:  ffffffffc0471dd9 vbg_req_perform
> ([kernel.kallsyms])
> 
> <..>
> 
> ```
> 
> I have attached the perf output.
> 
> Any thoughts where I am wrong?

It would seem that your installation of "perf" does not contain any "cycles" events that perfasm 
really wants. There is only "cpu-clock" event available. This probably means there either no 
hardware counters available, or there are not enough privileges to access them. I would recommend 
playing with "perf" to see what counters are available.

$ perf stat -vvv echo 1

  Performance counter stats for 'echo 1':

               0.53 msec task-clock                #    0.371 CPUs utilized
                  1      context-switches          #    0.002 M/sec
                  0      cpu-migrations            #    0.000 K/sec
                 64      page-faults               #    0.121 M/sec
          1,148,852      cycles                    #    2.169 GHz
             75,096      stalled-cycles-frontend   #    6.54% frontend cycles idle
            371,273      stalled-cycles-backend    #   32.32% backend cycles idle
      <not counted>      instructions                                                  (0.00%)
      <not counted>      branches                                                      (0.00%)
      <not counted>      branch-misses                                                 (0.00%)

        0.001427982 seconds time elapsed

        0.001174000 seconds user
        0.000000000 seconds sys

Otherwise, you may try to instruct perfasm to take "cpu-clock" as base counter, e.g. with -prof 
perfasm:events=cpu-clock.

-Aleksey



More information about the jmh-dev mailing list