perf trace: Cache the is_exit syscall test

No need to use two strcmp calls per syscall entry, do it just once, when
reading the per syscall info.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-lymtxhz0mg3adyt5e2pssn8f@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 77413534
...@@ -1108,6 +1108,7 @@ struct syscall { ...@@ -1108,6 +1108,7 @@ struct syscall {
struct event_format *tp_format; struct event_format *tp_format;
const char *name; const char *name;
bool filtered; bool filtered;
bool is_exit;
struct syscall_fmt *fmt; struct syscall_fmt *fmt;
size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg); size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
void **arg_parm; void **arg_parm;
...@@ -1473,6 +1474,8 @@ static int trace__read_syscall_info(struct trace *trace, int id) ...@@ -1473,6 +1474,8 @@ static int trace__read_syscall_info(struct trace *trace, int id)
if (sc->tp_format == NULL) if (sc->tp_format == NULL)
return -1; return -1;
sc->is_exit = !strcmp(name, "exit_group") || !strcmp(name, "exit");
return syscall__set_arg_fmts(sc); return syscall__set_arg_fmts(sc);
} }
...@@ -1643,7 +1646,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, ...@@ -1643,7 +1646,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed,
args, trace, thread); args, trace, thread);
if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { if (sc->is_exit) {
if (!trace->duration_filter && !trace->summary_only) { if (!trace->duration_filter && !trace->summary_only) {
trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
fprintf(trace->output, "%-70s\n", ttrace->entry_str); fprintf(trace->output, "%-70s\n", ttrace->entry_str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment