2316ef5891
It was using the first variation on producing a string representation for a binary flag, one that used the copy of uapi/linux/sched.h with 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/clone.sh | head -5 static const char *clone_flags[] = { [ilog2(0x00000100) + 1] = "VM", [ilog2(0x00000200) + 1] = "FS", [ilog2(0x00000400) + 1] = "FILES", [ilog2(0x00000800) + 1] = "SIGHAND", $ Now we can move uapi/linux/sched.h from tools/include/, that is used for building perf to 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/ZfnULIn3XKDq0bpc@x1 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
17 lines
513 B
Bash
Executable file
17 lines
513 B
Bash
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: LGPL-2.1
|
|
|
|
if [ $# -ne 1 ] ; then
|
|
beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
|
|
else
|
|
beauty_uapi_linux_dir=$1
|
|
fi
|
|
|
|
linux_sched=${beauty_uapi_linux_dir}/sched.h
|
|
|
|
printf "static const char *clone_flags[] = {\n"
|
|
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
|
|
grep -E $regex ${linux_sched} | \
|
|
sed -r "s/$regex/\2 \1/g" | \
|
|
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
|
|
printf "};\n"
|