perf target: Rename functions to avoid double negation
Rename perf_target__no_{cpu,task} to perf_target__has_{cpu,task} because
it's more intuitive and easy to parse (for human beings) when used with
negation.
The names are came out from David Ahern. It is intended to be a
mechanical substitution without any functional change.
The perf_target__none remains unchanged since I couldn't find a right
name and it is hardly used with negation.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Suggested-by: David Ahern <dsahern@gmail.com>
Suggested-by: Ingo Molnar <mingo@kernel.org>
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/1337161549-9870-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
978da300c7
commit
aa22dd4990
@@ -292,10 +292,10 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
|
||||
|
||||
attr->inherit = !no_inherit;
|
||||
|
||||
if (!perf_target__no_cpu(&target))
|
||||
if (perf_target__has_cpu(&target))
|
||||
return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
|
||||
group, group_fd);
|
||||
if (perf_target__no_task(&target) && (!group || evsel == first)) {
|
||||
if (!perf_target__has_task(&target) && (!group || evsel == first)) {
|
||||
attr->disabled = 1;
|
||||
attr->enable_on_exec = 1;
|
||||
}
|
||||
@@ -972,7 +972,7 @@ static void print_stat(int argc, const char **argv)
|
||||
if (!csv_output) {
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, " Performance counter stats for ");
|
||||
if (perf_target__no_task(&target)) {
|
||||
if (!perf_target__has_task(&target)) {
|
||||
fprintf(output, "\'%s", argv[0]);
|
||||
for (i = 1; i < argc; i++)
|
||||
fprintf(output, " %s", argv[i]);
|
||||
@@ -1194,13 +1194,13 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
|
||||
} else if (big_num_opt == 0) /* User passed --no-big-num */
|
||||
big_num = false;
|
||||
|
||||
if (!argc && perf_target__no_task(&target))
|
||||
if (!argc && !perf_target__has_task(&target))
|
||||
usage_with_options(stat_usage, options);
|
||||
if (run_count <= 0)
|
||||
usage_with_options(stat_usage, options);
|
||||
|
||||
/* no_aggr, cgroup are for system-wide only */
|
||||
if ((no_aggr || nr_cgroups) && perf_target__no_cpu(&target)) {
|
||||
if ((no_aggr || nr_cgroups) && !perf_target__has_cpu(&target)) {
|
||||
fprintf(stderr, "both cgroup and no-aggregation "
|
||||
"modes only available in system-wide mode\n");
|
||||
|
||||
@@ -1213,9 +1213,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
|
||||
perf_target__validate(&target);
|
||||
|
||||
if (perf_evlist__create_maps(evsel_list, &target) < 0) {
|
||||
if (!perf_target__no_task(&target))
|
||||
if (perf_target__has_task(&target))
|
||||
pr_err("Problems finding threads of monitor\n");
|
||||
if (!perf_target__no_cpu(&target))
|
||||
if (perf_target__has_cpu(&target))
|
||||
perror("failed to parse CPUs map");
|
||||
|
||||
usage_with_options(stat_usage, options);
|
||||
|
||||
Reference in New Issue
Block a user