summaryrefslogtreecommitdiff
path: root/tools/perf/trace/beauty/madvise_behavior.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/trace/beauty/madvise_behavior.sh')
-rwxr-xr-xtools/perf/trace/beauty/madvise_behavior.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/trace/beauty/madvise_behavior.sh b/tools/perf/trace/beauty/madvise_behavior.sh
new file mode 100755
index 000000000000..60ef8640ee70
--- /dev/null
+++ b/tools/perf/trace/beauty/madvise_behavior.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+header_dir=$1
+
+printf "static const char *madvise_advices[] = {\n"
+regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
+egrep $regex ${header_dir}/mman-common.h | \
+ sed -r "s/$regex/\2 \1/g" | \
+ sort -n | xargs printf "\t[%s] = \"%s\",\n"
+printf "};\n"