• Namhyung Kim's avatar
    perf report: Add 'typeoff' sort key · 871304a7
    Namhyung Kim authored
    The typeoff sort key shows the data type name, offset and the name of
    the field.  This is useful to see which field in the struct is accessed
    most frequently.
    
      $ perf report -s type,typeoff --hierarchy --stdio
      ...
      #     Overhead  Data Type / Data Type Offset
      # ............  ............................
      #
      ...
            1.23%     struct cfs_rq
               0.19%    struct cfs_rq +404 (throttle_count)
               0.19%    struct cfs_rq +0 (load.weight)
               0.19%    struct cfs_rq +336 (leaf_cfs_rq_list.next)
               0.09%    struct cfs_rq +272 (propagate)
               0.09%    struct cfs_rq +196 (removed.nr)
               0.09%    struct cfs_rq +80 (curr)
               0.09%    struct cfs_rq +544 (lt_b_children_throttled)
               0.06%    struct cfs_rq +320 (rq)
    
    Committer testing:
    
    Again with the perf.data from the previous csets:
    
      # perf report --stdio -s type,typeoff
      # To display the perf.data header info, please use --header/--header-only options.
      #
      #
      # Total Lost Samples: 0
      #
      # Samples: 4  of event 'cpu_atom/mem-loads,ldlat=30/P'
      # Event count (approx.): 7
      #
      # Overhead  Data Type  Data Type Offset
      # ........  .........  ................
      #
          42.86%  struct list_head  struct list_head +8 (prev)
          42.86%  (unknown)  (unknown) +0 (no field)
          14.29%  char       char +0 (no field)
    
      #
      # (Tip: To see callchains in a more compact form: perf report -g folded)
      #
      # perf report --stdio -s dso,type,typeoff
      # To display the perf.data header info, please use --header/--header-only options.
      #
      #
      # Total Lost Samples: 0
      #
      # Samples: 4  of event 'cpu_atom/mem-loads,ldlat=30/P'
      # Event count (approx.): 7
      #
      # Overhead  Shared Object         Data Type  Data Type Offset
      # ........  ....................  .........  ................
      #
          42.86%  [kernel.kallsyms]     struct list_head  struct list_head +8 (prev)
          28.57%  libc.so.6             (unknown)  (unknown) +0 (no field)
          14.29%  [kernel.kallsyms]     char       char +0 (no field)
          14.29%  ld-linux-x86-64.so.2  (unknown)  (unknown) +0 (no field)
    
      #
      # (Tip: If you have debuginfo enabled, try: perf report -s sym,srcline)
      #
      #
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    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-13-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    871304a7
perf-report.txt 21.6 KB