• Namhyung Kim's avatar
    perf report: Add 'type' sort key · 2f2c41bd
    Namhyung Kim authored
    The 'type' sort key is to aggregate hist entries by data type they
    access.  Add mem_type field to hist_entry struct to save the type.  If
    hist_entry__get_data_type() returns NULL, it'd use the 'unknown_type'
    instance.
    
    Committer testing:
    
    Before:
    
      # perf mem record  sleep 2s
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.037 MB perf.data (4 samples) ]
      root@number:/home/acme/Downloads# perf report --stdio -s type
      Error:
      Unknown --sort key: `type'
       Usage: perf report [<options>]
    
          -s, --sort <key[,key2...]>
                                sort by key(s): overhead overhead_sys overhead_us overhead_guest_sys
                                overhead_guest_us overhead_children sample period
                                pid comm dso symbol parent cpu socket srcline srcfile
                                local_weight weight transaction trace symbol_size
                                dso_size cgroup cgroup_id ipc_null time code_page_size
                                local_ins_lat ins_lat local_p_stage_cyc p_stage_cyc
                                addr local_retire_lat retire_lat simd dso_from dso_to
                                symbol_from symbol_to mispredict abort in_tx cycles
                                srcline_from srcline_to ipc_lbr addr_from addr_to
                                symbol_daddr dso_daddr locked tlb mem snoop dcacheline
                                symbol_iaddr phys_daddr data_page_size blocked
      #
    
    After:
    
      # 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
      # ........  .........
      #
         100.00%  (unknown)
    
      #
      # (Tip: Print event counts in CSV format with: perf stat -x,)
      #
      # rpm -q kernel-debuginfo
      kernel-debuginfo-6.6.4-200.fc39.x86_64
      # uname -r
      6.6.4-200.fc39.x86_64
      #
    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-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    2f2c41bd
hist.h 17 KB