summaryrefslogtreecommitdiff
path: root/tools/perf/trace/beauty/socket.sh
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2021-11-08 16:05:53 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-11-12 16:40:34 +0300
commit795f91db262ccc85dbc996ba27ce4ac6df529a85 (patch)
tree46fb53ae16e7f694be4ad312eb24b9918edaaa11 /tools/perf/trace/beauty/socket.sh
parentfa020dd78f9b6ec589c046c2b19a8a38127c3025 (diff)
downloadlinux-795f91db262ccc85dbc996ba27ce4ac6df529a85.tar.xz
perf beauty: Rename socket_ipproto.sh to socket.sh to hold more socket table generators
To avoid having to add new entries to tools/perf/Makefile.perf prep socket.sh so that it can generate other socket table generators, such as the upcoming SOL_ socket level one. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/trace/beauty/socket.sh')
-rwxr-xr-xtools/perf/trace/beauty/socket.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/trace/beauty/socket.sh b/tools/perf/trace/beauty/socket.sh
new file mode 100755
index 000000000000..de0f2f29017f
--- /dev/null
+++ b/tools/perf/trace/beauty/socket.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1
+
+[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
+
+printf "static const char *socket_ipproto[] = {\n"
+regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'
+
+egrep $regex ${header_dir}/in.h | \
+ sed -r "s/$regex/\2 \1/g" | \
+ sort | xargs printf "\t[%s] = \"%s\",\n"
+printf "};\n"