perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 19 Mar 2024 17:49:32 +0000 (14:49 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 21 Mar 2024 16:54:40 +0000 (13:54 -0300)
commitf122b3d6d179455ec77dc17690bea7e970433254
treea9cb9dcdfa2b881acee0dcca2f1508facd9fd15a
parent3d6cfbaf279ddec9d92d434268ac7aab1a4935ca
perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument

It was using the first variation on producing a string representation
for a binary flag, one that used the system's stat.h and preprocessor
tricks that had to be updated everytime a new flag was introduced.

Use the more recent scrape script + strarray +
strarray__scnprintf_flags() combo.

  $ tools/perf/trace/beauty/statx_mask.sh
  static const char *statx_mask[] = {
   [ilog2(0x00000001) + 1] = "TYPE",
   [ilog2(0x00000002) + 1] = "MODE",
   [ilog2(0x00000004) + 1] = "NLINK",
   [ilog2(0x00000008) + 1] = "UID",
   [ilog2(0x00000010) + 1] = "GID",
   [ilog2(0x00000020) + 1] = "ATIME",
   [ilog2(0x00000040) + 1] = "MTIME",
   [ilog2(0x00000080) + 1] = "CTIME",
   [ilog2(0x00000100) + 1] = "INO",
   [ilog2(0x00000200) + 1] = "SIZE",
   [ilog2(0x00000400) + 1] = "BLOCKS",
   [ilog2(0x00000800) + 1] = "BTIME",
   [ilog2(0x00001000) + 1] = "MNT_ID",
   [ilog2(0x00002000) + 1] = "DIOALIGN",
   [ilog2(0x00004000) + 1] = "MNT_ID_UNIQUE",
  };
  $

Now we need a copy of uapi/linux/stat.h from tools/include/ in the
scrape only directory tools/perf/trace/beauty/include.

Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/20240320193115.811899-3-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf
tools/perf/check-headers.sh
tools/perf/trace/beauty/include/uapi/linux/stat.h [new file with mode: 0644]
tools/perf/trace/beauty/statx.c
tools/perf/trace/beauty/statx_mask.sh [new file with mode: 0755]