• Thomas Richter's avatar
    perf stat: Do not fail on metrics on s390 z/VM systems · c2f3d7df
    Thomas Richter authored
    On s390 z/VM virtual machines command 'perf list' also displays metrics:
    
      # perf list | grep -A 20 'Metric Groups:'
      Metric Groups:
    
      No_group:
       cpi
            [Cycles per Instruction]
       est_cpi
            [Estimated Instruction Complexity CPI infinite Level 1]
       finite_cpi
            [Cycles per Instructions from Finite cache/memory]
       l1mp
            [Level One Miss per 100 Instructions]
       l2p
            [Percentage sourced from Level 2 cache]
       l3p
            [Percentage sourced from Level 3 on same chip cache]
       l4lp
            [Percentage sourced from Level 4 Local cache on same book]
       l4rp
            [Percentage sourced from Level 4 Remote cache on different book]
       memp
            [Percentage sourced from memory]
       ....
      #
    
    The command
    
      # perf stat -M cpi -- true
      event syntax error: '{CPU_CYCLES/metric-id=CPU_CYCLES/.....'
                            \___ Bad event or PMU
    
      Unable to find PMU or event on a PMU of 'CPU_CYCLES'
    
       event syntax error: '{CPU_CYCLES/metric-id=CPU_CYCLES/...'
                            \___ Cannot find PMU `CPU_CYCLES'.
                                 Missing kernel support?
     #
    
    fails. 'perf stat' should not fail on metrics when the referenced CPU
    Counter Measurement PMU is not available.
    
    Output after:
    
      # perf stat -M est_cpi -- sleep 1
    
      Performance counter stats for 'sleep 1':
    
         1,000,887,494 ns   duration_time   #     0.00 est_cpi
    
           1.000887494 seconds time elapsed
    
           0.000143000 seconds user
           0.000662000 seconds sys
    
     #
    
    Fixes: 7f76b311 ("perf list: Add IBM z16 event description for s390")
    Suggested-by: default avatarIan Rogers <irogers@google.com>
    Reviewed-by: default avatarIan Rogers <irogers@google.com>
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240404064806.1362876-2-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c2f3d7df
transaction.json 3.76 KB