aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-04-26 01:15:19 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-02 14:23:11 -0400
commitb809ac100e2f12ebf1b58ff522dba15651a77d27 (patch)
treeb5e4b894ed8cd8d0e1eb3e6252f2204f5bfae764 /tools
parent4bd0f2d2c0cf14de9c84c2fe689120c6b0f667c8 (diff)
perf evlist: Make create_maps() take struct perf_target
Now we have all information that needed to create cpu/thread maps in struct perf_target, it'd be better using it as an argument. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Reviewed-by: David Ahern <dsahern@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1335417327-11796-6-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c4
-rw-r--r--tools/perf/builtin-test.c7
-rw-r--r--tools/perf/builtin-top.c4
-rw-r--r--tools/perf/util/evlist.c12
-rw-r--r--tools/perf/util/evlist.h4
5 files changed, 15 insertions, 16 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3596ccab6d3b..d16590942cec 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -891,9 +891,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
891 rec->opts.target.uid == UINT_MAX - 1) 891 rec->opts.target.uid == UINT_MAX - 1)
892 goto out_free_fd; 892 goto out_free_fd;
893 893
894 if (perf_evlist__create_maps(evsel_list, rec->opts.target.pid, 894 if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0)
895 rec->opts.target.tid, rec->opts.target.uid,
896 rec->opts.target.cpu_list) < 0)
897 usage_with_options(record_usage, record_options); 895 usage_with_options(record_usage, record_options);
898 896
899 list_for_each_entry(pos, &evsel_list->entries, node) { 897 list_for_each_entry(pos, &evsel_list->entries, node) {
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 27882d86e9ab..9d9abbbe23be 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1165,6 +1165,9 @@ realloc:
1165static int test__PERF_RECORD(void) 1165static int test__PERF_RECORD(void)
1166{ 1166{
1167 struct perf_record_opts opts = { 1167 struct perf_record_opts opts = {
1168 .target = {
1169 .uid = UINT_MAX,
1170 },
1168 .no_delay = true, 1171 .no_delay = true,
1169 .freq = 10, 1172 .freq = 10,
1170 .mmap_pages = 256, 1173 .mmap_pages = 256,
@@ -1207,9 +1210,7 @@ static int test__PERF_RECORD(void)
1207 * perf_evlist__prepare_workload we'll fill in the only thread 1210 * perf_evlist__prepare_workload we'll fill in the only thread
1208 * we're monitoring, the one forked there. 1211 * we're monitoring, the one forked there.
1209 */ 1212 */
1210 err = perf_evlist__create_maps(evlist, opts.target.pid, 1213 err = perf_evlist__create_maps(evlist, &opts.target);
1211 opts.target.tid, UINT_MAX,
1212 opts.target.cpu_list);
1213 if (err < 0) { 1214 if (err < 0) {
1214 pr_debug("Not enough memory to create thread/cpu maps\n"); 1215 pr_debug("Not enough memory to create thread/cpu maps\n");
1215 goto out_delete_evlist; 1216 goto out_delete_evlist;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4f47952eddbd..2a0ec09b9b77 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1258,9 +1258,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
1258 if (top.target.uid_str != NULL && top.target.uid == UINT_MAX - 1) 1258 if (top.target.uid_str != NULL && top.target.uid == UINT_MAX - 1)
1259 goto out_delete_evlist; 1259 goto out_delete_evlist;
1260 1260
1261 if (perf_evlist__create_maps(top.evlist, top.target.pid, 1261 if (perf_evlist__create_maps(top.evlist, &top.target) < 0)
1262 top.target.tid, top.target.uid,
1263 top.target.cpu_list) < 0)
1264 usage_with_options(top_usage, options); 1262 usage_with_options(top_usage, options);
1265 1263
1266 if (!top.evlist->nr_entries && 1264 if (!top.evlist->nr_entries &&
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7080901a2717..a43e2c56d1c6 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -599,18 +599,20 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
599 return perf_evlist__mmap_per_cpu(evlist, prot, mask); 599 return perf_evlist__mmap_per_cpu(evlist, prot, mask);
600} 600}
601 601
602int perf_evlist__create_maps(struct perf_evlist *evlist, const char *target_pid, 602int perf_evlist__create_maps(struct perf_evlist *evlist,
603 const char *target_tid, uid_t uid, const char *cpu_list) 603 struct perf_target *target)
604{ 604{
605 evlist->threads = thread_map__new_str(target_pid, target_tid, uid); 605 evlist->threads = thread_map__new_str(target->pid, target->tid,
606 target->uid);
606 607
607 if (evlist->threads == NULL) 608 if (evlist->threads == NULL)
608 return -1; 609 return -1;
609 610
610 if (uid != UINT_MAX || (cpu_list == NULL && target_tid)) 611 if (target->uid != UINT_MAX ||
612 (target->cpu_list == NULL && target->tid))
611 evlist->cpus = cpu_map__dummy_new(); 613 evlist->cpus = cpu_map__dummy_new();
612 else 614 else
613 evlist->cpus = cpu_map__new(cpu_list); 615 evlist->cpus = cpu_map__new(target->cpu_list);
614 616
615 if (evlist->cpus == NULL) 617 if (evlist->cpus == NULL)
616 goto out_delete_threads; 618 goto out_delete_threads;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 21f1c9e57f13..58abb63ac13a 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -106,8 +106,8 @@ static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
106 evlist->threads = threads; 106 evlist->threads = threads;
107} 107}
108 108
109int perf_evlist__create_maps(struct perf_evlist *evlist, const char *target_pid, 109int perf_evlist__create_maps(struct perf_evlist *evlist,
110 const char *tid, uid_t uid, const char *cpu_list); 110 struct perf_target *target);
111void perf_evlist__delete_maps(struct perf_evlist *evlist); 111void perf_evlist__delete_maps(struct perf_evlist *evlist);
112int perf_evlist__set_filters(struct perf_evlist *evlist); 112int perf_evlist__set_filters(struct perf_evlist *evlist);
113 113