aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f954c26de231..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;
@@ -1276,11 +1277,11 @@ static const char *thread__fd_path(struct thread *thread, int fd,
1276 if (fd < 0) 1277 if (fd < 0)
1277 return NULL; 1278 return NULL;
1278 1279
1279 if ((fd > ttrace->paths.max || ttrace->paths.table[fd] == NULL)) 1280 if ((fd > ttrace->paths.max || ttrace->paths.table[fd] == NULL)) {
1280 if (!trace->live) 1281 if (!trace->live)
1281 return NULL; 1282 return NULL;
1282 ++trace->stats.proc_getname; 1283 ++trace->stats.proc_getname;
1283 if (thread__read_fd_path(thread, fd)) { 1284 if (thread__read_fd_path(thread, fd))
1284 return NULL; 1285 return NULL;
1285 } 1286 }
1286 1287
@@ -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
@@ -1629,7 +1632,6 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
1629 return -1; 1632 return -1;
1630 1633
1631 args = perf_evsel__sc_tp_ptr(evsel, args, sample); 1634 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
1632 ttrace = thread->priv;
1633 1635
1634 if (ttrace->entry_str == NULL) { 1636 if (ttrace->entry_str == NULL) {
1635 ttrace->entry_str = malloc(1024); 1637 ttrace->entry_str = malloc(1024);
@@ -1644,7 +1646,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
1644 printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, 1646 printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed,
1645 args, trace, thread); 1647 args, trace, thread);
1646 1648
1647 if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { 1649 if (sc->is_exit) {
1648 if (!trace->duration_filter && !trace->summary_only) { 1650 if (!trace->duration_filter && !trace->summary_only) {
1649 trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); 1651 trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
1650 fprintf(trace->output, "%-70s\n", ttrace->entry_str); 1652 fprintf(trace->output, "%-70s\n", ttrace->entry_str);
@@ -1687,8 +1689,6 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
1687 ++trace->stats.vfs_getname; 1689 ++trace->stats.vfs_getname;
1688 } 1690 }
1689 1691
1690 ttrace = thread->priv;
1691
1692 ttrace->exit_time = sample->time; 1692 ttrace->exit_time = sample->time;
1693 1693
1694 if (ttrace->entry_time) { 1694 if (ttrace->entry_time) {