Commit 5089f20ee7104bd219cafefa62d83f53e75cc44c

Authored by Arnaldo Carvalho de Melo
1 parent 774135344f

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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

tools/perf/builtin-trace.c
... ... @@ -1108,6 +1108,7 @@
1108 1108 struct event_format *tp_format;
1109 1109 const char *name;
1110 1110 bool filtered;
  1111 + bool is_exit;
1111 1112 struct syscall_fmt *fmt;
1112 1113 size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
1113 1114 void **arg_parm;
... ... @@ -1473,6 +1474,8 @@
1473 1474 if (sc->tp_format == NULL)
1474 1475 return -1;
1475 1476  
  1477 + sc->is_exit = !strcmp(name, "exit_group") || !strcmp(name, "exit");
  1478 +
1476 1479 return syscall__set_arg_fmts(sc);
1477 1480 }
1478 1481  
... ... @@ -1643,7 +1646,7 @@
1643 1646 printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed,
1644 1647 args, trace, thread);
1645 1648  
1646   - if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) {
  1649 + if (sc->is_exit) {
1647 1650 if (!trace->duration_filter && !trace->summary_only) {
1648 1651 trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
1649 1652 fprintf(trace->output, "%-70s\n", ttrace->entry_str);