• Namhyung Kim's avatar
    perf test: Add shadow stat test · 94b69c61
    Namhyung Kim authored
    It calculates IPC from the cycles and instruction counts and compares it
    with the shadow stat for both global aggregation (default) and no
    aggregation mode.
    
     $ perf stat -a -A -e cycles,instructions sleep 1
    
       Performance counter stats for 'system wide':
    
      CPU0   39,580,880      cycles
      CPU1   45,426,945      cycles
      CPU2   31,151,685      cycles
      CPU3   55,167,421      cycles
      CPU0   17,073,564      instructions      #    0.43  insn per cycle
      CPU1   34,955,764      instructions      #    0.77  insn per cycle
      CPU2   15,688,459      instructions      #    0.50  insn per cycle
      CPU3   34,699,217      instructions      #    0.63  insn per cycle
    
           1.003275495 seconds time elapsed
    
    In this example, the 'insn per cycle' should be matched to the number
    for each cpu.  For CPU2, 0.50 = 15,688,459 / 31,151,685 .
    
    Committer testing:
    
      # perf test shadow
      78: perf stat metrics (shadow stat) test                            : Ok
      #
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lore.kernel.org/lkml/20201127041404.390276-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    94b69c61
stat+shadow_stat.sh 1.48 KB