From: Arnaldo Carvalho de Melo Date: Mon, 8 Nov 2021 18:29:10 +0000 (-0300) Subject: perf trace: Beautify the 'level' argument of setsockopt X-Git-Tag: v6.1-rc5~2622^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0826b7fd0a0188d9f8388ff031dd0b3e3beb77a6;p=platform%2Fkernel%2Flinux-starfive.git perf trace: Beautify the 'level' argument of setsockopt # perf trace -e setsockopt 0.000 ( 0.019 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 50, optval: 0x7ffee2c0c134, optlen: 4) = 0 0.022 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 11, optval: 0x7ffee2c0c114, optlen: 4) = 0 0.027 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 8, optval: 0x7ffee2c0c134, optlen: 4) = 0 0.032 ( 0.002 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 10, optval: 0x7ffee2c0c134, optlen: 4) = 0 0.036 ( 0.002 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 25, optval: 0x7ffee2c0c114, optlen: 4) = 0 0.043 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: 1, optname: 62, optval: 0x7ffee2c0c0fc, optlen: 4) = 0 0.055 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: 1, optname: 25) ^C# So the simple straight STRARRAY method is not enough as SOL_SOCKET is '1' in most architectures but some use 0xffff (alpha, mips, parisc and sparc), so a followup patch will create a specialized scnprintf to cover that. Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index aa5d220..0b52e08 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1123,6 +1123,8 @@ static struct syscall_fmt syscall_fmts[] = { .arg = { [0] = STRARRAY(which, itimers), }, }, { .name = "setrlimit", .arg = { [0] = STRARRAY(resource, rlimit_resources), }, }, + { .name = "setsockopt", + .arg = { [1] = STRARRAY(level, socket_level), }, }, { .name = "socket", .arg = { [0] = STRARRAY(family, socket_families), [1] = { .scnprintf = SCA_SK_TYPE, /* type */ },