aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-05-16 05:45:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-17 11:32:54 -0400
commitd1cb9fce92c41454bd594fb0920575fc63301878 (patch)
tree02b1c6b97504b2ba3a2a8f3e33bbb651bb6e98e2
parent879d77d0cbe20ad1d6099a1e16f03b72c0649828 (diff)
perf target: Add uses_mmap field
If perf doesn't mmap on event (like perf stat), it should not create per-task-per-cpu events. So just use a dummy cpu map to create a per-task event for this case. Signed-off-by: Namhyung Kim <namhyung.kim@lge.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/1337161549-9870-3-git-send-email-namhyung.kim@lge.com [ committer note: renamed .need_mmap to .uses_mmap ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-record.c3
-rw-r--r--tools/perf/builtin-test.c1
-rw-r--r--tools/perf/builtin-top.c3
-rw-r--r--tools/perf/util/evlist.c2
-rw-r--r--tools/perf/util/target.h1
5 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d19058a7b84c..8a3dfac161e2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -754,6 +754,9 @@ static struct perf_record record = {
754 .user_freq = UINT_MAX, 754 .user_freq = UINT_MAX,
755 .user_interval = ULLONG_MAX, 755 .user_interval = ULLONG_MAX,
756 .freq = 1000, 756 .freq = 1000,
757 .target = {
758 .uses_mmap = true,
759 },
757 }, 760 },
758 .write_mode = WRITE_FORCE, 761 .write_mode = WRITE_FORCE,
759 .file_new = true, 762 .file_new = true,
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 9d9abbbe23be..4eaa665fd32b 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1167,6 +1167,7 @@ static int test__PERF_RECORD(void)
1167 struct perf_record_opts opts = { 1167 struct perf_record_opts opts = {
1168 .target = { 1168 .target = {
1169 .uid = UINT_MAX, 1169 .uid = UINT_MAX,
1170 .uses_mmap = true,
1170 }, 1171 },
1171 .no_delay = true, 1172 .no_delay = true,
1172 .freq = 10, 1173 .freq = 10,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 553560a8b1be..3e981a710c4d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1162,6 +1162,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
1162 .freq = 1000, /* 1 KHz */ 1162 .freq = 1000, /* 1 KHz */
1163 .mmap_pages = 128, 1163 .mmap_pages = 128,
1164 .sym_pcnt_filter = 5, 1164 .sym_pcnt_filter = 5,
1165 .target = {
1166 .uses_mmap = true,
1167 },
1165 }; 1168 };
1166 char callchain_default_opt[] = "fractal,0.5,callee"; 1169 char callchain_default_opt[] = "fractal,0.5,callee";
1167 const struct option options[] = { 1170 const struct option options[] = {
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 87889f325678..4ac5f5ae4ce9 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -611,6 +611,8 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
611 611
612 if (perf_target__has_task(target)) 612 if (perf_target__has_task(target))
613 evlist->cpus = cpu_map__dummy_new(); 613 evlist->cpus = cpu_map__dummy_new();
614 else if (!perf_target__has_cpu(target) && !target->uses_mmap)
615 evlist->cpus = cpu_map__dummy_new();
614 else 616 else
615 evlist->cpus = cpu_map__new(target->cpu_list); 617 evlist->cpus = cpu_map__new(target->cpu_list);
616 618
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index c43f632955fa..a4be8575fda5 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -11,6 +11,7 @@ struct perf_target {
11 const char *uid_str; 11 const char *uid_str;
12 uid_t uid; 12 uid_t uid;
13 bool system_wide; 13 bool system_wide;
14 bool uses_mmap;
14}; 15};
15 16
16enum perf_target_errno { 17enum perf_target_errno {