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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user