]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf beauty socket: Add generator for socket level (SOL_*) string table
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 8 Nov 2021 13:48:13 +0000 (10:48 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Nov 2021 13:40:34 +0000 (10:40 -0300)
  $ tools/perf/trace/beauty/socket.sh
  static const char *socket_ipproto[] = {
   [0] = "IP",
   [1] = "ICMP",
  <SNIP>
   [255] = "RAW",
   [262] = "MPTCP",
  };

  static const char *socket_level[] = {
   [0] = "IP",
   [6] = "TCP",
   [17] = "UDP",
   [41] = "IPV6",
   [58] = "ICMPV6",
   [132] = "SCTP",
   [136] = "UDPLITE",
   [255] = "RAW",
   [256] = "IPX",
   [257] = "AX25",
   [258] = "ATALK",
   [259] = "NETROM",
   [260] = "ROSE",
   [261] = "DECNET",
   [262] = "X25",
   [263] = "PACKET",
   [264] = "ATM",
   [265] = "AAL",
   [266] = "IRDA",
   [267] = "NETBEUI",
   [268] = "LLC",
   [269] = "DCCP",
   [270] = "NETLINK",
   [271] = "TIPC",
   [272] = "RXRPC",
   [273] = "PPPOL2TP",
   [274] = "BLUETOOTH",
   [275] = "PNPIPE",
   [276] = "RDS",
   [277] = "IUCV",
   [278] = "CAIF",
   [279] = "ALG",
   [280] = "NFC",
   [281] = "KCM",
   [282] = "TLS",
   [283] = "XDP",
   [284] = "MPTCP",
   [285] = "MCTP",
  };
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf
tools/perf/trace/beauty/beauty.h
tools/perf/trace/beauty/socket.sh

index 50ac20798440af6ce2813cc22d20d34653027a65..80522bcfafe0695f2de23ef664acdee3fcfe5ac0 100644 (file)
@@ -519,8 +519,8 @@ $(kvm_ioctl_array): $(kvm_hdr_dir)/kvm.h $(kvm_ioctl_tbl)
 socket_arrays := $(beauty_outdir)/socket.c
 socket_tbl := $(srctree)/tools/perf/trace/beauty/socket.sh
 
-$(socket_arrays): $(linux_uapi_dir)/in.h $(socket_tbl)
-       $(Q)$(SHELL) '$(socket_tbl)' $(linux_uapi_dir) > $@
+$(socket_arrays): $(linux_uapi_dir)/in.h $(beauty_linux_dir)/socket.h $(socket_tbl)
+       $(Q)$(SHELL) '$(socket_tbl)' $(linux_uapi_dir) $(beauty_linux_dir) > $@
 
 sockaddr_arrays := $(beauty_outdir)/sockaddr.c
 sockaddr_tbl := $(srctree)/tools/perf/trace/beauty/sockaddr.sh
index d6dfe68a7612552ab0eebb2022064c660737566a..0501e8de0c59b7e5b8248cf07d6cd806fec01f8d 100644 (file)
@@ -62,6 +62,8 @@ size_t pid__scnprintf_fd(struct trace *trace, pid_t pid, int fd, char *bf, size_
 
 extern struct strarray strarray__socket_families;
 
+extern struct strarray strarray__socket_level;
+
 /**
  * augmented_arg: extra payload for syscall pointer arguments
  
index 7f1c9f0097c1920f7d96b1dd326f72275070d4b4..76330acb27e58511db4d9a10a54cd5c0d1e43ed9 100755 (executable)
@@ -3,8 +3,10 @@
 
 if [ $# -gt 0 ] ; then
        uapi_header_dir=$1
+       beauty_header_dir=$2
 else
        uapi_header_dir=tools/include/uapi/linux/
+       beauty_header_dir=tools/perf/trace/beauty/include/linux/
 fi
 
 printf "static const char *socket_ipproto[] = {\n"
@@ -13,4 +15,14 @@ ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+)
 egrep $ipproto_regex ${uapi_header_dir}/in.h | \
        sed -r "s/$ipproto_regex/\2 \1/g"       | \
        sort -n | xargs printf "\t[%s] = \"%s\",\n"
-printf "};\n"
+printf "};\n\n"
+
+printf "static const char *socket_level[] = {\n"
+socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?'
+
+egrep $socket_level_regex ${beauty_header_dir}/socket.h | \
+       sed -r "s/$socket_level_regex/\2 \1/g"  | \
+       sort -n | xargs printf "\t[%s] = \"%s\",\n"
+printf "};\n\n"
+
+printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'