提交 c5e6bd2e 编写于 作者: A Adrian Hunter 提交者: Arnaldo Carvalho de Melo

perf tests: Fix software clock events test setting maps

The test titled "Test software clock events have valid period values"
was setting cpu/thread maps directly.  Make it use the proper function
perf_evlist__set_maps() especially now that it also propagates the maps.
Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/r/1441699142-18905-15-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 29982722
...@@ -34,6 +34,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) ...@@ -34,6 +34,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
.disabled = 1, .disabled = 1,
.freq = 1, .freq = 1,
}; };
struct cpu_map *cpus;
struct thread_map *threads;
attr.sample_freq = 500; attr.sample_freq = 500;
...@@ -50,14 +52,19 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) ...@@ -50,14 +52,19 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
} }
perf_evlist__add(evlist, evsel); perf_evlist__add(evlist, evsel);
evlist->cpus = cpu_map__dummy_new(); cpus = cpu_map__dummy_new();
evlist->threads = thread_map__new_by_tid(getpid()); threads = thread_map__new_by_tid(getpid());
if (!evlist->cpus || !evlist->threads) { if (!cpus || !threads) {
err = -ENOMEM; err = -ENOMEM;
pr_debug("Not enough memory to create thread/cpu maps\n"); pr_debug("Not enough memory to create thread/cpu maps\n");
goto out_delete_evlist; goto out_free_maps;
} }
perf_evlist__set_maps(evlist, cpus, threads);
cpus = NULL;
threads = NULL;
if (perf_evlist__open(evlist)) { if (perf_evlist__open(evlist)) {
const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate"; const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate";
...@@ -107,6 +114,9 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) ...@@ -107,6 +114,9 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
err = -1; err = -1;
} }
out_free_maps:
cpu_map__put(cpus);
thread_map__put(threads);
out_delete_evlist: out_delete_evlist:
perf_evlist__delete(evlist); perf_evlist__delete(evlist);
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册