• Namhyung Kim's avatar
    perf report: Support data type profiling · 81e57dee
    Namhyung Kim authored
    Enable type annotation when the 'type' sort key is used.
    
    It shows type of variables the samples access at the moment.  Users can
    see which types are accessed frequently.
    
      $ perf report -s dso,type --stdio
      ...
      # Overhead  Shared Object      Data Type
      # ........  .................  .........
      #
          35.47%  [kernel.kallsyms]  (unknown)
           1.62%  [kernel.kallsyms]  struct sched_entry
           1.23%  [kernel.kallsyms]  struct cfs_rq
           0.83%  [kernel.kallsyms]  struct task_struct
           0.34%  [kernel.kallsyms]  struct list_head
           0.30%  [kernel.kallsyms]  struct mem_cgroup
      ...
    
    Committer testing:
    
    With the perf.data file collected in the previous cset:
    
      # perf report --stdio -s type
      # 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
      # ........  .........
      #
          42.86%  struct list_head
          42.86%  (unknown)
          14.29%  char
    
      #
      # (Tip: To record callchains for each sample: perf record -g)
      #
      # perf report --stdio -s dso,type
      # 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
      # ........  ....................  .........
      #
          42.86%  [kernel.kallsyms]     struct list_head
          28.57%  libc.so.6             (unknown)
          14.29%  [kernel.kallsyms]     char
          14.29%  ld-linux-x86-64.so.2  (unknown)
    
      #
      # (Tip: Save output of perf stat using: perf stat record <target workload>)
      #
      #
    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-10-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    81e57dee
builtin-report.c 49.5 KB