• Namhyung Kim's avatar
    perf annotate-data: Support event group display in TUI · 2b08f219
    Namhyung Kim authored
    Like in stdio, it should print all events in a group together.
    
    Committer notes:
    
    Collect it:
    
      root@number:~# perf record -a -e '{cpu_core/mem-loads,ldlat=30/P,cpu_core/mem-stores/P}'
      ^C[ perf record: Woken up 8 times to write data ]
      [ perf record: Captured and wrote 4.980 MB perf.data (55825 samples) ]
      root@number:~#
    
    Then do it in stdio:
    
      root@number:~# perf annotate --stdio --data-type
    
      Annotate type: 'union ' in /usr/lib64/libc.so.6 (1131 samples):
       event[0] = cpu_core/mem-loads,ldlat=30/P
       event[1] = cpu_core/mem-stores/P
      ============================================================================
               Percent     offset       size  field
        100.00  100.00          0         40  union    {
        100.00  100.00          0         40      struct __pthread_mutex_s    __data {
         48.61   23.46          0          4          int     __lock;
          0.00    0.48          4          4          unsigned int    __count;
          6.38   41.32          8          4          int     __owner;
          8.74   34.02         12          4          unsigned int    __nusers;
         35.66    0.26         16          4          int     __kind;
          0.61    0.45         20          2          short int       __spins;
          0.00    0.00         22          2          short int       __elision;
          0.00    0.00         24         16          __pthread_list_t        __list {
          0.00    0.00         24          8              struct __pthread_internal_list*     __prev;
          0.00    0.00         32          8              struct __pthread_internal_list*     __next;
                                                      };
                                                  };
          0.00    0.00          0          0      char*       __size;
         48.61   23.94          0          8      long int    __align;
                                              };
    
    Now with TUI before this patch:
    
      root@number:~# perf annotate --tui --data-type
      Annotate type: 'union ' (790 samples)
          Percent     Offset       Size  Field
           100.00          0         40  union  {
           100.00          0         40      struct __pthread_mutex_s __data {
            48.61          0          4          int  __lock;
             0.00          4          4          unsigned int __count;
             6.38          8          4          int  __owner;
             8.74         12          4          unsigned int __nusers;
            35.66         16          4          int  __kind;
             0.61         20          2          short int    __spins;
             0.00         22          2          short int    __elision;
             0.00         24         16          __pthread_list_t     __list {
             0.00         24          8              struct __pthread_internal_list*  __prev;
             0.00         32          8              struct __pthread_internal_list*  __next;
    
             0.00          0          0      char*    __size;
            48.61          0          8      long int __align;
                                         };
    
    And now after this patch:
    
    Annotate type: 'union ' (790 samples)
                   Percent     Offset       Size  Field
         100.00     100.00          0         40  union  {
         100.00     100.00          0         40      struct __pthread_mutex_s      __data {
          48.61      23.46          0          4          int       __lock;
           0.00       0.48          4          4          unsigned int      __count;
           6.38      41.32          8          4          int       __owner;
           8.74      34.02         12          4          unsigned int      __nusers;
          35.66       0.26         16          4          int       __kind;
           0.61       0.45         20          2          short int __spins;
           0.00       0.00         22          2          short int __elision;
           0.00       0.00         24         16          __pthread_list_t  __list {
           0.00       0.00         24          8              struct __pthread_internal_list*       __prev;
           0.00       0.00         32          8              struct __pthread_internal_list*       __next;
                                                          };
                                                      };
           0.00       0.00          0          0      char* __size;
          48.61      23.94          0          8      long int      __align;
                                                  };
    
    On a followup patch the --tui output should have this that is present in
    --stdio:
    
      And the --stdio has all the missing info in TUI:
    
        Annotate type: 'union ' in /usr/lib64/libc.so.6 (1131 samples):
         event[0] = cpu_core/mem-loads,ldlat=30/P
         event[1] = cpu_core/mem-stores/P
    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-6-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    2b08f219
annotate-data.c 7.67 KB