aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2014-06-17 13:29:24 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-06-19 15:13:13 -0400
commit5089f20ee7104bd219cafefa62d83f53e75cc44c (patch)
tree259334f6d31b2e4520ae0994fd6255a1867335e8
parent774135344fa8aa044290d030068f92e9a3aab8cc (diff)
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>
-rw-r--r--tools/perf/builtin-trace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 28c86e21fad9..5549cee61680 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1108,6 +1108,7 @@ struct syscall {
1108 struct event_format *tp_format; 1108 struct event_format *tp_format;
1109 const char *name; 1109 const char *name;
1110 bool filtered; 1110 bool filtered;
1111 bool is_exit;
1111 struct syscall_fmt *fmt; 1112 struct syscall_fmt *fmt;
1112 size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg); 1113 size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
1113 void **arg_parm; 1114 void **arg_parm;
@@ -1473,6 +1474,8 @@ static int trace__read_syscall_info(struct trace *trace, int id)
1473 if (sc->tp_format == NULL) 1474 if (sc->tp_format == NULL)
1474 return -1; 1475 return -1;
1475 1476
1477 sc->is_exit = !strcmp(name, "exit_group") || !strcmp(name, "exit");
1478
1476 return syscall__set_arg_fmts(sc); 1479 return syscall__set_arg_fmts(sc);
1477} 1480}
1478 1481
@@ -1643,7 +1646,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
1643 printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, 1646 printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed,
1644 args, trace, thread); 1647 args, trace, thread);
1645 1648
1646 if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { 1649 if (sc->is_exit) {
1647 if (!trace->duration_filter && !trace->summary_only) { 1650 if (!trace->duration_filter && !trace->summary_only) {
1648 trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); 1651 trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
1649 fprintf(trace->output, "%-70s\n", ttrace->entry_str); 1652 fprintf(trace->output, "%-70s\n", ttrace->entry_str);