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

perf tests: Fix task exit test setting maps

The test titled "Test number of exit event of a simple workload" 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-14-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 8c0498b6
...@@ -43,6 +43,8 @@ int test__task_exit(void) ...@@ -43,6 +43,8 @@ int test__task_exit(void)
}; };
const char *argv[] = { "true", NULL }; const char *argv[] = { "true", NULL };
char sbuf[STRERR_BUFSIZE]; char sbuf[STRERR_BUFSIZE];
struct cpu_map *cpus;
struct thread_map *threads;
signal(SIGCHLD, sig_handler); signal(SIGCHLD, sig_handler);
...@@ -58,14 +60,19 @@ int test__task_exit(void) ...@@ -58,14 +60,19 @@ int test__task_exit(void)
* perf_evlist__prepare_workload we'll fill in the only thread * perf_evlist__prepare_workload we'll fill in the only thread
* we're monitoring, the one forked there. * we're monitoring, the one forked there.
*/ */
evlist->cpus = cpu_map__dummy_new(); cpus = cpu_map__dummy_new();
evlist->threads = thread_map__new_by_tid(-1); threads = thread_map__new_by_tid(-1);
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;
err = perf_evlist__prepare_workload(evlist, &target, argv, false, err = perf_evlist__prepare_workload(evlist, &target, argv, false,
workload_exec_failed_signal); workload_exec_failed_signal);
if (err < 0) { if (err < 0) {
...@@ -114,6 +121,9 @@ int test__task_exit(void) ...@@ -114,6 +121,9 @@ int test__task_exit(void)
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.
先完成此消息的编辑!
想要评论请 注册