aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/code-reading.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-12-03 03:34:14 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-07 16:12:55 -0500
commit0fd4008ed755c52d85117302a3c2c108b2958420 (patch)
tree48d40b24f1d0dc8c579b8531b879d0e4fbf06d5a /tools/perf/tests/code-reading.c
parent046847935754f27c2e8334ff15abda0b733a1fd4 (diff)
perf test: Use machine__new_host in mmap thread code reading test
This is more straightforward than what we have now. It also fixes a segfault within machine__exit, that's caused by not creating kernel maps for machine.. We're calling machine__destroy_kernel_maps in machine__exit since commit: ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1449131658-1841-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/code-reading.c')
-rw-r--r--tools/perf/tests/code-reading.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 4417b6a079f0..26182ffcea75 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -433,7 +433,6 @@ enum {
433 433
434static int do_test_code_reading(bool try_kcore) 434static int do_test_code_reading(bool try_kcore)
435{ 435{
436 struct machines machines;
437 struct machine *machine; 436 struct machine *machine;
438 struct thread *thread; 437 struct thread *thread;
439 struct record_opts opts = { 438 struct record_opts opts = {
@@ -459,8 +458,7 @@ static int do_test_code_reading(bool try_kcore)
459 458
460 pid = getpid(); 459 pid = getpid();
461 460
462 machines__init(&machines); 461 machine = machine__new_host();
463 machine = &machines.host;
464 462
465 ret = machine__create_kernel_maps(machine); 463 ret = machine__create_kernel_maps(machine);
466 if (ret < 0) { 464 if (ret < 0) {
@@ -594,9 +592,8 @@ out_err:
594 cpu_map__put(cpus); 592 cpu_map__put(cpus);
595 thread_map__put(threads); 593 thread_map__put(threads);
596 } 594 }
597 machines__destroy_kernel_maps(&machines);
598 machine__delete_threads(machine); 595 machine__delete_threads(machine);
599 machines__exit(&machines); 596 machine__delete(machine);
600 597
601 return err; 598 return err;
602} 599}