Skip to content

Commit

Permalink
perf trace: Allow configuring if zeroed syscall args should be printed
Browse files Browse the repository at this point in the history
The default so far, since we show argument names followed by its values,
was to make the output more compact by suppressing most zeroed args.

Make this configurable so that users can choose what best suit their
needs.

Cc: Adrian Hunter <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Luis Cláudio Gonçalves <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Dec 18, 2018
1 parent ac96287 commit e7c634f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tools/perf/Documentation/perf-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ trace.*::
The initial use case is to add augmented_raw_syscalls.o to
activate the 'perf trace' logic that looks for syscall
pointer contents after the normal tracepoint payload.
trace.show_zeros::
Do not suppress syscall arguments that are equal to zero.

SEE ALSO
--------
Expand Down
6 changes: 5 additions & 1 deletion tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct trace {
bool show_tool_stats;
bool trace_syscalls;
bool kernel_syscallchains;
bool show_zeros;
bool force;
bool vfs_getname;
int trace_pgfaults;
Expand Down Expand Up @@ -1598,6 +1599,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
* strarray for it.
*/
if (val == 0 &&
!trace->show_zeros &&
!(sc->arg_fmt &&
(sc->arg_fmt[arg.idx].show_zero ||
sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY ||
Expand Down Expand Up @@ -3526,14 +3528,16 @@ static void trace__set_bpf_map_syscalls(struct trace *trace)

static int trace__config(const char *var, const char *value, void *arg)
{
struct trace *trace = arg;
int err = 0;

if (!strcmp(var, "trace.add_events")) {
struct trace *trace = arg;
struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
"event selector. use 'perf list' to list available events",
parse_events_option);
err = parse_events_option(&o, value, 0);
} else if (!strcmp(var, "trace.show_zeros")) {
trace->show_zeros = perf_config_bool(var, value);
}

return err;
Expand Down

0 comments on commit e7c634f

Please sign in to comment.