aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-01-19 11:08:15 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-01-24 16:47:37 -0500
commit0d37aa34f8806bb443dd3c8621fd9bdbb50c58bb (patch)
tree3e245385cdb75fec299f5e145243f062b70fd652 /tools/perf/builtin-record.c
parent9ae7d3351aac238eef9646479693105688fd9cc9 (diff)
perf tools: Introduce per user view
The new --uid command line option will show only the tasks for a given user, using the proc interface to figure out the existing tasks. Kernel work is needed to close races at startup, but this should already be useful in many use cases. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> 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-bdnspm000gw2l984a2t53o8z@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0abfb18b911f..32870eef952f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -44,6 +44,7 @@ struct perf_record {
44 struct perf_evlist *evlist; 44 struct perf_evlist *evlist;
45 struct perf_session *session; 45 struct perf_session *session;
46 const char *progname; 46 const char *progname;
47 const char *uid_str;
47 int output; 48 int output;
48 unsigned int page_size; 49 unsigned int page_size;
49 int realtime_prio; 50 int realtime_prio;
@@ -727,6 +728,7 @@ const struct option record_options[] = {
727 OPT_CALLBACK('G', "cgroup", &record.evlist, "name", 728 OPT_CALLBACK('G', "cgroup", &record.evlist, "name",
728 "monitor event in cgroup name only", 729 "monitor event in cgroup name only",
729 parse_cgroups), 730 parse_cgroups),
731 OPT_STRING('u', "uid", &record.uid_str, "user", "user to profile"),
730 OPT_END() 732 OPT_END()
731}; 733};
732 734
@@ -748,7 +750,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
748 argc = parse_options(argc, argv, record_options, record_usage, 750 argc = parse_options(argc, argv, record_options, record_usage,
749 PARSE_OPT_STOP_AT_NON_OPTION); 751 PARSE_OPT_STOP_AT_NON_OPTION);
750 if (!argc && rec->opts.target_pid == -1 && rec->opts.target_tid == -1 && 752 if (!argc && rec->opts.target_pid == -1 && rec->opts.target_tid == -1 &&
751 !rec->opts.system_wide && !rec->opts.cpu_list) 753 !rec->opts.system_wide && !rec->opts.cpu_list && !rec->uid_str)
752 usage_with_options(record_usage, record_options); 754 usage_with_options(record_usage, record_options);
753 755
754 if (rec->force && rec->append_file) { 756 if (rec->force && rec->append_file) {
@@ -788,11 +790,17 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
788 goto out_symbol_exit; 790 goto out_symbol_exit;
789 } 791 }
790 792
793 rec->opts.uid = parse_target_uid(rec->uid_str, rec->opts.target_tid,
794 rec->opts.target_pid);
795 if (rec->uid_str != NULL && rec->opts.uid == UINT_MAX - 1)
796 goto out_free_fd;
797
791 if (rec->opts.target_pid != -1) 798 if (rec->opts.target_pid != -1)
792 rec->opts.target_tid = rec->opts.target_pid; 799 rec->opts.target_tid = rec->opts.target_pid;
793 800
794 if (perf_evlist__create_maps(evsel_list, rec->opts.target_pid, 801 if (perf_evlist__create_maps(evsel_list, rec->opts.target_pid,
795 rec->opts.target_tid, rec->opts.cpu_list) < 0) 802 rec->opts.target_tid, rec->opts.uid,
803 rec->opts.cpu_list) < 0)
796 usage_with_options(record_usage, record_options); 804 usage_with_options(record_usage, record_options);
797 805
798 list_for_each_entry(pos, &evsel_list->entries, node) { 806 list_for_each_entry(pos, &evsel_list->entries, node) {