aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-06-25 01:42:24 -0400
committerIngo Molnar <mingo@kernel.org>2014-06-25 01:42:24 -0400
commit06c654ca8b824e04f59f3f99d403494a140c181f (patch)
tree75c82621d95feab7b7e01e31e85bd7a95f7f28dc /tools/perf/builtin-trace.c
parent98d350cf7ae077eb8083ccc7c1bfc838344ac590 (diff)
parentecdac96899e3db3f428e4d2e978f25e3f8d35a6c (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: User visible changes: * Add --repeat global option to 'perf bench' to be used in benchmarks such as the existing 'futex' one, that was modified to use it instead of a local option. (Davidlohr Bueso) * Fix fd -> pathname resolution in 'trace', be it using /proc or a vfs_getname probe point. (Arnaldo Carvalho de Melo) * Add suggestion of how to set perf_event_paranoid sysctl, to help non-root users trying tools like 'trace' to get a working environment. (Arnaldo Carvalho de Melo) Fixes: * Fix memory leak in the 'sched-messaging' perf bench test. (Davidlohr Bueso) * The -o and -n 'perf bench mem' options are mutually exclusive, emit error when both are specified. (Davidlohr Bueso) * Fix scrollbar refresh row index in the ui browser, problem exposed now that headers will be added and will be allowed to be switched on/off. (Jiri Olsa) Cleanups: * Remove needless reassignments in 'trace' (Arnaldo Carvalho de Melo) * Cache the is_exit syscall test in 'trace) (Arnaldo Carvalho de Melo) * No need to reimplement err() in 'perf bench sched-messaging', drop barf(). (Davidlohr Bueso). * Remove ev_name argument from perf_evsel__hists_browse, can be obtained from the other parameters. (Jiri Olsa) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
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) {