perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments
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)
commit3d6cfbaf279ddec9d92d434268ac7aab1a4935ca
treec72a9ef543a6cbee89b4797a15b47302019cca69
parent4cef0e7ae76b877e67909b16b3044f0b4a504f32
perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments

It was using the first variation on producing a string representation
for a binary flag, one that used the system's fcntl.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/fs_at_flags.sh
  static const char *fs_at_flags[] = {
   [ilog2(0x100) + 1] = "SYMLINK_NOFOLLOW",
   [ilog2(0x200) + 1] = "REMOVEDIR",
   [ilog2(0x400) + 1] = "SYMLINK_FOLLOW",
   [ilog2(0x800) + 1] = "NO_AUTOMOUNT",
   [ilog2(0x1000) + 1] = "EMPTY_PATH",
   [ilog2(0x0000) + 1] = "STATX_SYNC_AS_STAT",
   [ilog2(0x2000) + 1] = "STATX_FORCE_SYNC",
   [ilog2(0x4000) + 1] = "STATX_DONT_SYNC",
   [ilog2(0x8000) + 1] = "RECURSIVE",
   [ilog2(0x80000000) + 1] = "GETATTR_NOSEC",
  };
  $

Now we need a copy of uapi/linux/fcntl.h from tools/include/ in the
scrape only directory tools/perf/trace/beauty/include and will use that
fs_at_flags array for other fs syscalls.

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-2-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf
tools/perf/builtin-trace.c
tools/perf/check-headers.sh
tools/perf/trace/beauty/Build
tools/perf/trace/beauty/beauty.h
tools/perf/trace/beauty/fs_at_flags.c [new file with mode: 0644]
tools/perf/trace/beauty/fs_at_flags.sh [new file with mode: 0755]
tools/perf/trace/beauty/include/uapi/linux/fcntl.h [new file with mode: 0644]
tools/perf/trace/beauty/statx.c