Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Allow configuring if the syscall start timestamp should be printed

# trace -e open*,close,*sleep sleep 1
0.000 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3
0.016 close(fd: 3 ) = 0
0.024 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC ) = 3
0.074 close(fd: 3 ) = 0
0.235 openat(dfd: CWD, filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
0.251 close(fd: 3 ) = 0
0.285 nanosleep(rqtp: 0x7ffd68e6d620, rmtp: 0 ) = 0
1000.386 close(fd: 1 ) = 0
1000.395 close(fd: 2 ) = 0
#

# perf config trace.show_timestamp=no
# trace -e open*,close,*sleep sleep 1
openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3
close(fd: 3 ) = 0
openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC ) = 3
close(fd: 3 ) = 0
openat(dfd: CWD, filename: , flags: CLOEXEC ) = 3
close(fd: 3 ) = 0
nanosleep(rqtp: 0x7fffa79c38e0, rmtp: 0 ) = 0
close(fd: 1 ) = 0
close(fd: 2 ) = 0
#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-mjjnicy48367jah6ls4k0nk8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+11 -1
+3
tools/perf/Documentation/perf-config.txt
··· 535 535 trace.show_duration:: 536 536 Show syscall duration. 537 537 538 + trace.show_timestamp:: 539 + Show syscall start timestamp. 540 + 538 541 trace.show_zeros:: 539 542 Do not suppress syscall arguments that are equal to zero. 540 543
+8 -1
tools/perf/builtin-trace.c
··· 127 127 bool show_tool_stats; 128 128 bool trace_syscalls; 129 129 bool kernel_syscallchains; 130 + bool show_tstamp; 130 131 bool show_duration; 131 132 bool show_zeros; 132 133 bool force; ··· 1216 1215 static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread, 1217 1216 u64 duration, bool duration_calculated, u64 tstamp, FILE *fp) 1218 1217 { 1219 - size_t printed = trace__fprintf_tstamp(trace, tstamp, fp); 1218 + size_t printed = 0; 1219 + 1220 + if (trace->show_tstamp) 1221 + printed = trace__fprintf_tstamp(trace, tstamp, fp); 1220 1222 if (trace->show_duration) 1221 1223 printed += fprintf_duration(duration, duration_calculated, fp); 1222 1224 return printed + trace__fprintf_comm_tid(trace, thread, fp); ··· 3542 3538 "event selector. use 'perf list' to list available events", 3543 3539 parse_events_option); 3544 3540 err = parse_events_option(&o, value, 0); 3541 + } else if (!strcmp(var, "trace.show_timestamp")) { 3542 + trace->show_tstamp = perf_config_bool(var, value); 3545 3543 } else if (!strcmp(var, "trace.show_duration")) { 3546 3544 trace->show_duration = perf_config_bool(var, value); 3547 3545 } else if (!strcmp(var, "trace.show_zeros")) { ··· 3580 3574 }, 3581 3575 .output = stderr, 3582 3576 .show_comm = true, 3577 + .show_tstamp = true, 3583 3578 .show_duration = true, 3584 3579 .trace_syscalls = false, 3585 3580 .kernel_syscallchains = false,