• Namhyung Kim's avatar
    perf annotate-data: Support --skip-empty option · cb1898f5
    Namhyung Kim authored
    The --skip-empty option is to hide dummy events in a group.  Like other
    output mode in 'perf report' and 'perf annotate', the data-type
    profiling output should support the option.
    
    Committer testing:
    
    With dummy:
    
      root@number:~# perf annotate --stdio --group --data-type --skip-empty | head -24
      Annotate type: 'pthread_mutex_t' in /usr/lib64/libc.so.6 (50 samples):
       event[0] = cpu_atom/mem-loads,ldlat=30/P
       event[1] = cpu_atom/mem-stores/P
       event[2] = dummy:u
      ============================================================================
                       Percent     offset       size  field
        100.00  100.00    0.00          0         40  pthread_mutex_t	 {
        100.00  100.00    0.00          0         40      struct __pthread_mutex_s	__data {
         45.21   84.54    0.00          0          4          int	__lock;
          0.00    0.00    0.00          4          4          unsigned int	__count;
          0.00    1.83    0.00          8          4          int	__owner;
          5.19   10.65    0.00         12          4          unsigned int	__nusers;
         49.61    2.97    0.00         16          4          int	__kind;
          0.00    0.00    0.00         20          2          short int	__spins;
          0.00    0.00    0.00         22          2          short int	__elision;
          0.00    0.00    0.00         24         16          __pthread_list_t	__list {
          0.00    0.00    0.00         24          8              struct __pthread_internal_list*	__prev;
          0.00    0.00    0.00         32          8              struct __pthread_internal_list*	__next;
                                                              };
                                                          };
          0.00    0.00    0.00          0          0      char[]	__size;
         45.21   84.54    0.00          0          8      long int	__align;
                                                    };
    Skipping it:
    
      root@number:~# perf annotate --stdio --group --data-type --skip-empty | head -24
      Annotate type: 'pthread_mutex_t' in /usr/lib64/libc.so.6 (50 samples):
       event[0] = cpu_atom/mem-loads,ldlat=30/P
       event[1] = cpu_atom/mem-stores/P
      ============================================================================
               Percent     offset       size  field
        100.00  100.00          0         40  pthread_mutex_t	 {
        100.00  100.00          0         40      struct __pthread_mutex_s	__data {
         45.21   84.54          0          4          int	__lock;
          0.00    0.00          4          4          unsigned int	__count;
          0.00    1.83          8          4          int	__owner;
          5.19   10.65         12          4          unsigned int	__nusers;
         49.61    2.97         16          4          int	__kind;
          0.00    0.00         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;
         45.21   84.54          0          8      long int	__align;
                                              };
    
      Annotate type: 'pthread_mutexattr_t' in /usr/lib64/libc.so.6 (1 samples):
      root@number:~#
    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/20240807061713.1642924-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    cb1898f5
annotate-data.c 7.99 KB