summaryrefslogtreecommitdiff
path: root/tools/perf/tests
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-12-18 22:15:48 (GMT)
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 19:40:12 (GMT)
commit876650e6c3209861a8949111140d805b3440951f (patch)
tree92923adf71a21512f20889c49ace7ed42b139f29 /tools/perf/tests
parent28a6b6aa54878a6a239e901698b3fc111bbcc54f (diff)
downloadlinux-876650e6c3209861a8949111140d805b3440951f.tar.xz
perf machine: Introduce struct machines
That consolidates the grouping of host + guests, isolating a bit more of functionality now centered on 'perf_session' that can be used independently in tools that don't need a 'perf_session' instance, but needs to have all the thread/map/symbol machinery. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-c700rsiphpmzv8klogojpfut@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rw-r--r--tools/perf/tests/hists_link.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 0f1aae3..27860a0 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -75,13 +75,11 @@ static struct {
{ "[kernel]", kernel_syms, ARRAY_SIZE(kernel_syms) },
};
-static struct machine *setup_fake_machine(void)
+static struct machine *setup_fake_machine(struct machines *machines)
{
- struct rb_root machine_root = RB_ROOT;
- struct machine *machine;
+ struct machine *machine = machines__find(machines, HOST_KERNEL_ID);
size_t i;
- machine = machines__findnew(&machine_root, HOST_KERNEL_ID);
if (machine == NULL) {
pr_debug("Not enough memory for machine setup\n");
return NULL;
@@ -435,6 +433,7 @@ static void print_hists(struct hists *hists)
int test__hists_link(void)
{
int err = -1;
+ struct machines machines;
struct machine *machine = NULL;
struct perf_evsel *evsel, *first;
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
@@ -452,8 +451,10 @@ int test__hists_link(void)
/* default sort order (comm,dso,sym) will be used */
setup_sorting(NULL, NULL);
+ machines__init(&machines);
+
/* setup threads/dso/map/symbols also */
- machine = setup_fake_machine();
+ machine = setup_fake_machine(&machines);
if (!machine)
goto out;
@@ -492,11 +493,7 @@ int test__hists_link(void)
out:
/* tear down everything */
perf_evlist__delete(evlist);
-
- if (machine) {
- machine__delete_threads(machine);
- machine__delete(machine);
- }
+ machines__exit(&machines);
return err;
}