diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-11-10 15:30:10 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-11-10 15:30:10 -0300 |
commit | 6ac73820993c13f30d226f9521f8ffae62acdf42 (patch) | |
tree | fe27f3275de530093124a031d9b5589ebf8badf2 /tools/perf/trace/beauty/timespec.c | |
parent | perf intel-pt: Add hybrid CPU compatibility test (diff) | |
download | wireguard-linux-6ac73820993c13f30d226f9521f8ffae62acdf42.tar.xz wireguard-linux-6ac73820993c13f30d226f9521f8ffae62acdf42.zip |
perf trace: Add augmenter for clock_gettime's rqtp timespec arg
One more before going the BTF way:
# perf trace -e /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o,*nanosleep
? pool-gsd-smart/2893 ... [continued]: clock_nanosleep()) = 0
? gpm/1042 ... [continued]: clock_nanosleep()) = 0
1.232 pool-gsd-smart/2893 clock_nanosleep(rqtp: { .tv_sec: 1, .tv_nsec: 0 }, rmtp: 0x7f64d7ffec50) ...
1.232 pool-gsd-smart/2893 ... [continued]: clock_nanosleep()) = 0
327.329 gpm/1042 clock_nanosleep(rqtp: { .tv_sec: 2, .tv_nsec: 0 }, rmtp: 0x7ffddfd1cf20) ...
1002.482 pool-gsd-smart/2893 clock_nanosleep(rqtp: { .tv_sec: 1, .tv_nsec: 0 }, rmtp: 0x7f64d7ffec50) = 0
327.329 gpm/1042 ... [continued]: clock_nanosleep()) = 0
2003.947 pool-gsd-smart/2893 clock_nanosleep(rqtp: { .tv_sec: 1, .tv_nsec: 0 }, rmtp: 0x7f64d7ffec50) ...
2003.947 pool-gsd-smart/2893 ... [continued]: clock_nanosleep()) = 0
2327.858 gpm/1042 clock_nanosleep(rqtp: { .tv_sec: 2, .tv_nsec: 0 }, rmtp: 0x7ffddfd1cf20) ...
? crond/1384 ... [continued]: clock_nanosleep()) = 0
3005.382 pool-gsd-smart/2893 clock_nanosleep(rqtp: { .tv_sec: 1, .tv_nsec: 0 }, rmtp: 0x7f64d7ffec50) ...
3005.382 pool-gsd-smart/2893 ... [continued]: clock_nanosleep()) = 0
3675.633 crond/1384 clock_nanosleep(rqtp: { .tv_sec: 60, .tv_nsec: 0 }, rmtp: 0x7ffcc02b66b0) ...
^C#
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/trace/beauty/timespec.c')
-rw-r--r-- | tools/perf/trace/beauty/timespec.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/trace/beauty/timespec.c b/tools/perf/trace/beauty/timespec.c new file mode 100644 index 000000000000..e1a61f092aad --- /dev/null +++ b/tools/perf/trace/beauty/timespec.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: LGPL-2.1 +// Copyright (C) 2022, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> + +#include "trace/beauty/beauty.h" +#include <inttypes.h> +#include <time.h> + +static size_t syscall_arg__scnprintf_augmented_timespec(struct syscall_arg *arg, char *bf, size_t size) +{ + struct timespec *ts = (struct timespec *)arg->augmented.args; + + return scnprintf(bf, size, "{ .tv_sec: %" PRIu64 ", .tv_nsec: %" PRIu64 " }", ts->tv_sec, ts->tv_nsec); +} + +size_t syscall_arg__scnprintf_timespec(char *bf, size_t size, struct syscall_arg *arg) +{ + if (arg->augmented.args) + return syscall_arg__scnprintf_augmented_timespec(arg, bf, size); + + return scnprintf(bf, size, "%#lx", arg->val); +} |