]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
perf target: Add uses_mmap field
authorNamhyung Kim <namhyung.kim@lge.com>
Wed, 16 May 2012 09:45:49 +0000 (18:45 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 May 2012 15:32:54 +0000 (12:32 -0300)
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>
tools/perf/builtin-record.c
tools/perf/builtin-test.c
tools/perf/builtin-top.c
tools/perf/util/evlist.c
tools/perf/util/target.h

index d19058a7b84cfbd45547c8e2f004c82d7462580d..8a3dfac161e298bbab7f0912fd7429a52fbb1dd6 100644 (file)
@@ -754,6 +754,9 @@ static struct perf_record record = {
                .user_freq           = UINT_MAX,
                .user_interval       = ULLONG_MAX,
                .freq                = 1000,
+               .target              = {
+                       .uses_mmap   = true,
+               },
        },
        .write_mode = WRITE_FORCE,
        .file_new   = true,
index 9d9abbbe23be4ab932bd88028bbee3d1ceef8a43..4eaa665fd32b9739c2aec448417dc8176fb56495 100644 (file)
@@ -1167,6 +1167,7 @@ static int test__PERF_RECORD(void)
        struct perf_record_opts opts = {
                .target = {
                        .uid = UINT_MAX,
+                       .uses_mmap = true,
                },
                .no_delay   = true,
                .freq       = 10,
index 553560a8b1beee45c4c645ab7936393a46ae93f3..3e981a710c4d2f9323317d34ae128e2f29a6c826 100644 (file)
@@ -1162,6 +1162,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
                .freq                = 1000, /* 1 KHz */
                .mmap_pages          = 128,
                .sym_pcnt_filter     = 5,
+               .target              = {
+                       .uses_mmap   = true,
+               },
        };
        char callchain_default_opt[] = "fractal,0.5,callee";
        const struct option options[] = {
index 87889f325678723cf409fb05b852bc6e12d9739d..4ac5f5ae4ce903a9284d6b4f105493da2bc454c5 100644 (file)
@@ -611,6 +611,8 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
 
        if (perf_target__has_task(target))
                evlist->cpus = cpu_map__dummy_new();
+       else if (!perf_target__has_cpu(target) && !target->uses_mmap)
+               evlist->cpus = cpu_map__dummy_new();
        else
                evlist->cpus = cpu_map__new(target->cpu_list);
 
index c43f632955fa22c28ae546401b2183222518f252..a4be8575fda56ea77b3b9fad73f6aab9a2995ac2 100644 (file)
@@ -11,6 +11,7 @@ struct perf_target {
        const char   *uid_str;
        uid_t        uid;
        bool         system_wide;
+       bool         uses_mmap;
 };
 
 enum perf_target_errno {