• Namhyung Kim's avatar
    perf annotate: Add --insn-stat option for debugging · 58824fa0
    Namhyung Kim authored
    This is for a debugging purpose.  It'd be useful to see per-instrucion
    level success/failure stats.
    
      $ perf annotate --data-type --insn-stat
      Annotate Instruction stats
      total 264, ok 143 (54.2%), bad 121 (45.8%)
    
        Name      :  Good   Bad
      -----------------------------------------------------------
        movq      :    45    31
        movl      :    22    11
        popq      :     0    19
        cmpl      :    16     3
        addq      :     8     7
        cmpq      :    11     3
        cmpxchgl  :     3     7
        cmpxchgq  :     8     0
        incl      :     3     3
        movzbl    :     4     2
        incq      :     4     2
        decl      :     6     0
        ...
    
    Committer notes:
    
    So these are about being able to find the type for accesses from these
    instructions, we should improve the naming, but it is for debugging, we
    can improve this later:
    
      @@ -3726,6 +3759,10 @@ struct annotated_data_type *hist_entry__get_data_type(struct hist_entry *he)
                              continue;
    
                      mem_type = find_data_type(ms, ip, op_loc->reg, op_loc->offset);
      +               if (mem_type)
      +                       istat->good++;
      +               else
      +                       istat->bad++;
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: linux-toolchains@vger.kernel.org
    Cc: linux-trace-devel@vger.kernel.org
    Link: https://lore.kernel.org/r/20231213001323.718046-18-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    58824fa0
annotate.c 91.6 KB