perf session: Remove wrappers to machines__find
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 14 Feb 2015 17:26:15 +0000 (14:26 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 23 Feb 2015 01:22:41 +0000 (22:22 -0300)
Start to untangle session from delivering samples, as there are
tools that want to use ordered_events and don't use perf_session at all.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-rn4pk3pjxd78sgzrkn19tktp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/session.c

index 504b7e664e6ccde229b32dc17da6d814e098abd4..fac08e1f6330986dd6c1da490e6318a022459910 100644 (file)
@@ -797,8 +797,7 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
                sample_read__printf(sample, evsel->attr.read_format);
 }
 
-static struct machine *
-       perf_session__find_machine_for_cpumode(struct perf_session *session,
+static struct machine *machines__find_for_cpumode(struct machines *machines,
                                               union perf_event *event,
                                               struct perf_sample *sample)
 {
@@ -816,14 +815,13 @@ static struct machine *
                else
                        pid = sample->pid;
 
-               machine = perf_session__find_machine(session, pid);
+               machine = machines__find(machines, pid);
                if (!machine)
-                       machine = perf_session__findnew_machine(session,
-                                               DEFAULT_GUEST_KERNEL_ID);
+                       machine = machines__find(machines, DEFAULT_GUEST_KERNEL_ID);
                return machine;
        }
 
-       return &session->machines.host;
+       return &machines->host;
 }
 
 static int deliver_sample_value(struct perf_session *session,
@@ -907,8 +905,7 @@ int perf_session__deliver_event(struct perf_session *session,
 
        evsel = perf_evlist__id2evsel(session->evlist, sample->id);
 
-       machine = perf_session__find_machine_for_cpumode(session, event,
-                                                        sample);
+       machine = machines__find_for_cpumode(&session->machines, event, sample);
 
        switch (event->header.type) {
        case PERF_RECORD_SAMPLE: