• Namhyung Kim's avatar
    perf annotate-data: Show first-level children by default in TUI · 7f3c8f13
    Namhyung Kim authored
    Now default is to fold everything but it only shows the name of the
    top-level data type which is not very useful.  Instead just expand the
    top level entry so that it can show the layout at a higher level.
    
      Annotate type: 'struct task_struct' (4 samples)
            Percent     Offset       Size  Field
      -      100.00          0       9792  struct task_struct {                           ◆
      +        0.50          0         24      struct thread_info     thread_info;        ▒
               0.00         24          4      unsigned int   __state;                    ▒
               0.00         32          8      void*  stack;                              ▒
      +        0.00         40          4      refcount_t     usage;                      ▒
               0.00         44          4      unsigned int   flags;                      ▒
               0.00         48          4      unsigned int   ptrace;                     ▒
               0.00         52          4      int    on_cpu;                             ▒
      +        0.00         56         16      struct __call_single_node      wake_entry; ▒
               0.00         72          4      unsigned int   wakee_flips;                ▒
               0.00         80          8      long unsigned int      wakee_flip_decay_ts;▒
               0.00         88          8      struct task_struct*    last_wakee;         ▒
               0.00         96          4      int    recent_used_cpu;                    ▒
               0.00        100          4      int    wake_cpu;                           ▒
               0.00        104          4      int    on_rq;                              ▒
               0.00        108          4      int    prio;                               ▒
               0.00        112          4      int    static_prio;                        ▒
               0.00        116          4      int    normal_prio;                        ▒
               0.00        120          4      unsigned int   rt_priority;                ▒
      +        0.00        128        256      struct sched_entity    se;                 ▒
      +        0.00        384         48      struct sched_rt_entity rt;                 ▒
      +        0.00        432        224      struct sched_dl_entity dl;                 ▒
               0.00        656          8      struct sched_class*    sched_class;        ▒
      ...
    
    Committer testing:
    
      # perf mem record -a sleep 5s
      # perf annotate --group --data-type=pthread_mutex_t
    
     Annotate type: 'pthread_mutex_t' (13 samples)
          Percent     Offset       Size  Field
    -      100.00          0         40  pthread_mutex_t {                                ▒
    -      100.00          0         40      struct __pthread_mutex_s       __data {      ▒
            39.45          0          4          int        __lock;                       ▒
             0.00          4          4          unsigned int       __count;              ▒
             7.80          8          4          int        __owner;                      ▒
             6.88         12          4          unsigned int       __nusers;             ▒
            45.87         16          4          int        __kind;                       ▒
             0.00         20          2          short int  __spins;                      ▒
             0.00         22          2          short int  __elision;                    ▒
    +        0.00         24         16          __pthread_list_t   __list;               ▒
                                             };                                           ▒
             0.00          0          0      char[] __size;                               ▒
            39.45          0          8      long int       __align;
    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: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20240812194447.2049187-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    7f3c8f13
annotate-data.c 14.9 KB