• Namhyung Kim's avatar
    perf annotate-data: Add hist_entry__annotate_data_tui() · d001c7a7
    Namhyung Kim authored
    Support data type profiling output on TUI.
    
    Testing from Arnaldo:
    
    First make sure that the debug information for your workload binaries
    in embedded in them by building it with '-g' or install the debuginfo
    packages, since our workload is 'find':
    
      root@number:~# type find
      find is hashed (/usr/bin/find)
      root@number:~# rpm -qf /usr/bin/find
      findutils-4.9.0-5.fc39.x86_64
      root@number:~# dnf debuginfo-install findutils
      <SNIP>
      root@number:~#
    
    Then collect some data:
    
      root@number:~# echo 1 > /proc/sys/vm/drop_caches
      root@number:~# perf mem record find / > /dev/null
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.331 MB perf.data (3982 samples) ]
      root@number:~#
    
    Finally do data-type annotation with the following command, that will
    default, as 'perf report' to the --tui mode, with lines colored to
    highlight the hotspots, etc.
    
      root@number:~# perf annotate --data-type
      Annotate type: 'struct predicate' (58 samples)
          Percent     Offset       Size  Field
           100.00          0        312  struct predicate {
             0.00          0          8      PRED_FUNC        pred_func;
             0.00          8          8      char*    p_name;
             0.00         16          4      enum predicate_type      p_type;
             0.00         20          4      enum predicate_precedence        p_prec;
             0.00         24          1      _Bool    side_effects;
             0.00         25          1      _Bool    no_default_print;
             0.00         26          1      _Bool    need_stat;
             0.00         27          1      _Bool    need_type;
             0.00         28          1      _Bool    need_inum;
             0.00         32          4      enum EvaluationCost      p_cost;
             0.00         36          4      float    est_success_rate;
             0.00         40          1      _Bool    literal_control_chars;
             0.00         41          1      _Bool    artificial;
             0.00         48          8      char*    arg_text;
      <SNIP>
    Reviewed-by: default avatarIan Rogers <irogers@google.com>
    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: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20240411033256.2099646-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d001c7a7
annotate-data.c 46.8 KB