aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-05-07 01:09:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-07 16:52:05 -0400
commitd67356e7f80f5c2ef487bedc11a91d5fe18c5a15 (patch)
tree4aa72408deba73d07cc8232ecb43a3782acb2ab7 /tools/perf/builtin-stat.c
parent16ad2ffb822cd28e2330284a60fdfec8bb90bbb0 (diff)
perf target: Consolidate target task/cpu checking
There are places that check whether target task/cpu is given or not and some of them didn't check newly introduced uid or cpu list. Add and use three of helper functions to treat them properly. 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-7-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index bb7723221c0d..d9ff24637eeb 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -290,10 +290,10 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
290 290
291 attr->inherit = !no_inherit; 291 attr->inherit = !no_inherit;
292 292
293 if (target.system_wide) 293 if (!perf_target__no_cpu(&target))
294 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, 294 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
295 group, group_fd); 295 group, group_fd);
296 if (!target.pid && !target.tid && (!group || evsel == first)) { 296 if (perf_target__no_task(&target) && (!group || evsel == first)) {
297 attr->disabled = 1; 297 attr->disabled = 1;
298 attr->enable_on_exec = 1; 298 attr->enable_on_exec = 1;
299 } 299 }
@@ -443,7 +443,7 @@ static int run_perf_stat(int argc __used, const char **argv)
443 exit(-1); 443 exit(-1);
444 } 444 }
445 445
446 if (!target.tid && !target.pid && !target.system_wide) 446 if (perf_target__none(&target))
447 evsel_list->threads->map[0] = child_pid; 447 evsel_list->threads->map[0] = child_pid;
448 448
449 /* 449 /*
@@ -965,7 +965,7 @@ static void print_stat(int argc, const char **argv)
965 if (!csv_output) { 965 if (!csv_output) {
966 fprintf(output, "\n"); 966 fprintf(output, "\n");
967 fprintf(output, " Performance counter stats for "); 967 fprintf(output, " Performance counter stats for ");
968 if (!target.pid && !target.tid) { 968 if (perf_target__no_task(&target)) {
969 fprintf(output, "\'%s", argv[0]); 969 fprintf(output, "\'%s", argv[0]);
970 for (i = 1; i < argc; i++) 970 for (i = 1; i < argc; i++)
971 fprintf(output, " %s", argv[i]); 971 fprintf(output, " %s", argv[i]);
@@ -1187,13 +1187,13 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1187 } else if (big_num_opt == 0) /* User passed --no-big-num */ 1187 } else if (big_num_opt == 0) /* User passed --no-big-num */
1188 big_num = false; 1188 big_num = false;
1189 1189
1190 if (!argc && !target.pid && !target.tid) 1190 if (!argc && perf_target__no_task(&target))
1191 usage_with_options(stat_usage, options); 1191 usage_with_options(stat_usage, options);
1192 if (run_count <= 0) 1192 if (run_count <= 0)
1193 usage_with_options(stat_usage, options); 1193 usage_with_options(stat_usage, options);
1194 1194
1195 /* no_aggr, cgroup are for system-wide only */ 1195 /* no_aggr, cgroup are for system-wide only */
1196 if ((no_aggr || nr_cgroups) && !target.system_wide) { 1196 if ((no_aggr || nr_cgroups) && perf_target__no_cpu(&target)) {
1197 fprintf(stderr, "both cgroup and no-aggregation " 1197 fprintf(stderr, "both cgroup and no-aggregation "
1198 "modes only available in system-wide mode\n"); 1198 "modes only available in system-wide mode\n");
1199 1199