aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-05-07 01:09:04 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-07 16:52:22 -0400
commit77a6f014e9ae330c747c66bebfddf29abf9b89e9 (patch)
tree0d066e78eb3386ea36eaf1d927e680d3958e680f /tools
parentd67356e7f80f5c2ef487bedc11a91d5fe18c5a15 (diff)
perf stat: Use perf_evlist__create_maps
Use same function with perf record and top to share the code checks combinations of different switches. 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/1336367344-28071-8-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-stat.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d9ff24637eeb..e720ba7b801e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -175,7 +175,9 @@ static struct perf_event_attr very_very_detailed_attrs[] = {
175 175
176static struct perf_evlist *evsel_list; 176static struct perf_evlist *evsel_list;
177 177
178static struct perf_target target; 178static struct perf_target target = {
179 .uid = UINT_MAX,
180};
179 181
180static int run_idx = 0; 182static int run_idx = 0;
181static int run_count = 1; 183static int run_count = 1;
@@ -1205,20 +1207,12 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1205 1207
1206 perf_target__validate(&target); 1208 perf_target__validate(&target);
1207 1209
1208 evsel_list->threads = thread_map__new_str(target.pid, 1210 if (perf_evlist__create_maps(evsel_list, &target) < 0) {
1209 target.tid, UINT_MAX); 1211 if (!perf_target__no_task(&target))
1210 if (evsel_list->threads == NULL) { 1212 pr_err("Problems finding threads of monitor\n");
1211 pr_err("Problems finding threads of monitor\n"); 1213 if (!perf_target__no_cpu(&target))
1212 usage_with_options(stat_usage, options); 1214 perror("failed to parse CPUs map");
1213 }
1214
1215 if (target.system_wide)
1216 evsel_list->cpus = cpu_map__new(target.cpu_list);
1217 else
1218 evsel_list->cpus = cpu_map__dummy_new();
1219 1215
1220 if (evsel_list->cpus == NULL) {
1221 perror("failed to parse CPUs map");
1222 usage_with_options(stat_usage, options); 1216 usage_with_options(stat_usage, options);
1223 return -1; 1217 return -1;
1224 } 1218 }