diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-30 19:02:15 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-31 09:42:23 -0400 |
commit | 39878d492c049796202b70dc0ef14449cafa3cb4 (patch) | |
tree | 7d51ff8ff842aac673e50f54b9ff9025546ce636 | |
parent | 997bba8cf1875d9715e792c445e1a9c7a4c365e2 (diff) |
perf trace: Pretty print getrandom() args
# trace -e getrandom
35622.560 ( 0.023 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35622.585 ( 0.006 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35622.594 ( 0.004 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35627.395 ( 0.010 ms): libvirtd/1353 getrandom(buf: 0x7f7a1bfa35c0, count: 16, flags: NONBLOCK ) = 16
35630.940 ( 0.013 ms): fwupd/16120 getrandom(buf: 0x7f63243aa5c0, count: 16, flags: NONBLOCK ) = 16
35718.613 ( 0.015 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35718.629 ( 0.005 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35718.637 ( 0.004 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
35719.355 ( 0.010 ms): libvirtd/1353 getrandom(buf: 0x7f7a1bfa35c0, count: 16, flags: NONBLOCK ) = 16
35721.042 ( 0.030 ms): fwupd/16120 getrandom(buf: 0x7f63243aa5c0, count: 16, flags: NONBLOCK ) = 16
41090.830 ( 0.012 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41090.845 ( 0.004 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41090.851 ( 0.004 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41091.750 ( 0.010 ms): libvirtd/1353 getrandom(buf: 0x7f7a1bfa35c0, count: 16, flags: NONBLOCK ) = 16
41091.823 ( 0.006 ms): fwupd/16120 getrandom(buf: 0x7f63243aa5c0, count: 16, flags: NONBLOCK ) = 16
41122.078 ( 0.053 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41122.129 ( 0.009 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41122.139 ( 0.004 ms): systemd-udevd/631 getrandom(buf: 0x55621e3c18f0, count: 16, flags: NONBLOCK) = 16
41124.492 ( 0.007 ms): libvirtd/1353 getrandom(buf: 0x7f7a1bfa35c0, count: 16, flags: NONBLOCK ) = 16
41124.470 ( 0.013 ms): fwupd/16120 getrandom(buf: 0x7f63243aa5c0, count: 16, flags: NONBLOCK ) = 16
41590.832 ( 0.014 ms): chrome/5957 getrandom(buf: 0x7fabac7b15b0, count: 16, flags: NONBLOCK ) = 16
41590.884 ( 0.004 ms): chrome/5957 getrandom(buf: 0x7fabac7b15c0, count: 16, flags: NONBLOCK ) = 16
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-gca0n1p3aca3depey703ph2q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-trace.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 0c8bcb94934e..c45c1cfeb866 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/filter.h> | 44 | #include <linux/filter.h> |
45 | #include <linux/audit.h> | 45 | #include <linux/audit.h> |
46 | #include <sys/ptrace.h> | 46 | #include <sys/ptrace.h> |
47 | #include <linux/random.h> | ||
47 | 48 | ||
48 | /* For older distros: */ | 49 | /* For older distros: */ |
49 | #ifndef MAP_STACK | 50 | #ifndef MAP_STACK |
@@ -1045,6 +1046,29 @@ static size_t syscall_arg__scnprintf_seccomp_flags(char *bf, size_t size, | |||
1045 | 1046 | ||
1046 | #define SCA_SECCOMP_FLAGS syscall_arg__scnprintf_seccomp_flags | 1047 | #define SCA_SECCOMP_FLAGS syscall_arg__scnprintf_seccomp_flags |
1047 | 1048 | ||
1049 | static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, | ||
1050 | struct syscall_arg *arg) | ||
1051 | { | ||
1052 | int printed = 0, flags = arg->val; | ||
1053 | |||
1054 | #define P_FLAG(n) \ | ||
1055 | if (flags & GRND_##n) { \ | ||
1056 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | ||
1057 | flags &= ~GRND_##n; \ | ||
1058 | } | ||
1059 | |||
1060 | P_FLAG(RANDOM); | ||
1061 | P_FLAG(NONBLOCK); | ||
1062 | #undef P_FLAG | ||
1063 | |||
1064 | if (flags) | ||
1065 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | ||
1066 | |||
1067 | return printed; | ||
1068 | } | ||
1069 | |||
1070 | #define SCA_GETRANDOM_FLAGS syscall_arg__scnprintf_getrandom_flags | ||
1071 | |||
1048 | #define STRARRAY(arg, name, array) \ | 1072 | #define STRARRAY(arg, name, array) \ |
1049 | .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ | 1073 | .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ |
1050 | .arg_parm = { [arg] = &strarray__##array, } | 1074 | .arg_parm = { [arg] = &strarray__##array, } |
@@ -1137,6 +1161,8 @@ static struct syscall_fmt { | |||
1137 | { .name = "getdents64", .errmsg = true, | 1161 | { .name = "getdents64", .errmsg = true, |
1138 | .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, }, | 1162 | .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, }, |
1139 | { .name = "getitimer", .errmsg = true, STRARRAY(0, which, itimers), }, | 1163 | { .name = "getitimer", .errmsg = true, STRARRAY(0, which, itimers), }, |
1164 | { .name = "getrandom", .errmsg = true, | ||
1165 | .arg_scnprintf = { [2] = SCA_GETRANDOM_FLAGS, /* flags */ }, }, | ||
1140 | { .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), }, | 1166 | { .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), }, |
1141 | { .name = "getxattr", .errmsg = true, | 1167 | { .name = "getxattr", .errmsg = true, |
1142 | .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, }, | 1168 | .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, }, |