summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/target.h
diff options
context:
space:
mode:
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>2013-12-04 23:56:40 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-04 17:46:37 +0100
commit9c105fbc94a67ea5943d309d9a78ca669e0ddc61 (patch)
tree0de6e9599cbd1bd1e2a58cdb5050818be1b8ec1a /tools/perf/util/target.h
parentperf tools: Remove condition in machine__get_kernel_start_addr. (diff)
downloadlinux-9c105fbc94a67ea5943d309d9a78ca669e0ddc61.tar.xz
linux-9c105fbc94a67ea5943d309d9a78ca669e0ddc61.zip
perf target: Move the checking of which map function to call into function.
Check for cpu_map__dummy_new() or cpu_map__new() to be called in perf_evlist__create_maps() is more complicated. This patch moves the checking work into target.h, combining two conditions and making perf_evlist__create_maps() more readable. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/b8c41f1fd2c4f0df71eb7b19aea74fb64d46cdda.1386197481.git.yangds.fnst@cn.fujitsu.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/target.h')
-rw-r--r--tools/perf/util/target.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index 31dd2e9a27d0..7381b1ca4041 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -63,4 +63,17 @@ static inline bool target__none(struct target *target)
return !target__has_task(target) && !target__has_cpu(target);
}
+static inline bool target__uses_dummy_map(struct target *target)
+{
+ bool use_dummy = false;
+
+ if (target->default_per_cpu)
+ use_dummy = target->per_thread ? true : false;
+ else if (target__has_task(target) ||
+ (!target__has_cpu(target) && !target->uses_mmap))
+ use_dummy = true;
+
+ return use_dummy;
+}
+
#endif /* _PERF_TARGET_H */