diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-28 04:56:39 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-28 07:39:12 -0500 |
commit | 743eb868657bdb1b26c7b24077ca21c67c82c777 (patch) | |
tree | 4803b557725213043ccd5d3f83d2eec796a49f69 /tools/perf/builtin-report.c | |
parent | d20deb64e0490ee9442b5181bc08a62d2cadcb90 (diff) |
perf tools: Resolve machine earlier and pass it to perf_event_ops
Reducing the exposure of perf_session further, so that we can use the
classes in cases where no perf.data file is created.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
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-stua66dcscsezzrcdugvbmvd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 8795520f6e1d..ea64fbbdff43 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -52,18 +52,18 @@ struct perf_report { | |||
52 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | 52 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static int perf_session__add_hist_entry(struct perf_session *session, | 55 | static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, |
56 | struct addr_location *al, | 56 | struct addr_location *al, |
57 | struct perf_sample *sample, | 57 | struct perf_sample *sample, |
58 | struct perf_evsel *evsel) | 58 | struct machine *machine) |
59 | { | 59 | { |
60 | struct symbol *parent = NULL; | 60 | struct symbol *parent = NULL; |
61 | int err = 0; | 61 | int err = 0; |
62 | struct hist_entry *he; | 62 | struct hist_entry *he; |
63 | 63 | ||
64 | if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { | 64 | if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { |
65 | err = perf_session__resolve_callchain(session, evsel, al->thread, | 65 | err = machine__resolve_callchain(machine, evsel, al->thread, |
66 | sample->callchain, &parent); | 66 | sample->callchain, &parent); |
67 | if (err) | 67 | if (err) |
68 | return err; | 68 | return err; |
69 | } | 69 | } |
@@ -107,12 +107,12 @@ static int process_sample_event(struct perf_event_ops *ops, | |||
107 | union perf_event *event, | 107 | union perf_event *event, |
108 | struct perf_sample *sample, | 108 | struct perf_sample *sample, |
109 | struct perf_evsel *evsel, | 109 | struct perf_evsel *evsel, |
110 | struct perf_session *session) | 110 | struct machine *machine) |
111 | { | 111 | { |
112 | struct perf_report *rep = container_of(ops, struct perf_report, ops); | 112 | struct perf_report *rep = container_of(ops, struct perf_report, ops); |
113 | struct addr_location al; | 113 | struct addr_location al; |
114 | 114 | ||
115 | if (perf_event__preprocess_sample(event, session, &al, sample, | 115 | if (perf_event__preprocess_sample(event, machine, &al, sample, |
116 | rep->annotate_init) < 0) { | 116 | rep->annotate_init) < 0) { |
117 | fprintf(stderr, "problem processing %d event, skipping it.\n", | 117 | fprintf(stderr, "problem processing %d event, skipping it.\n", |
118 | event->header.type); | 118 | event->header.type); |
@@ -128,7 +128,7 @@ static int process_sample_event(struct perf_event_ops *ops, | |||
128 | if (al.map != NULL) | 128 | if (al.map != NULL) |
129 | al.map->dso->hit = 1; | 129 | al.map->dso->hit = 1; |
130 | 130 | ||
131 | if (perf_session__add_hist_entry(session, &al, sample, evsel)) { | 131 | if (perf_evsel__add_hist_entry(evsel, &al, sample, machine)) { |
132 | pr_debug("problem incrementing symbol period, skipping event\n"); | 132 | pr_debug("problem incrementing symbol period, skipping event\n"); |
133 | return -1; | 133 | return -1; |
134 | } | 134 | } |
@@ -139,11 +139,11 @@ static int process_sample_event(struct perf_event_ops *ops, | |||
139 | static int process_read_event(struct perf_event_ops *ops, | 139 | static int process_read_event(struct perf_event_ops *ops, |
140 | union perf_event *event, | 140 | union perf_event *event, |
141 | struct perf_sample *sample __used, | 141 | struct perf_sample *sample __used, |
142 | struct perf_session *session) | 142 | struct perf_evsel *evsel, |
143 | struct machine *machine __used) | ||
143 | { | 144 | { |
144 | struct perf_report *rep = container_of(ops, struct perf_report, ops); | 145 | struct perf_report *rep = container_of(ops, struct perf_report, ops); |
145 | struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, | 146 | |
146 | event->read.id); | ||
147 | if (rep->show_threads) { | 147 | if (rep->show_threads) { |
148 | const char *name = evsel ? event_name(evsel) : "unknown"; | 148 | const char *name = evsel ? event_name(evsel) : "unknown"; |
149 | perf_read_values_add_value(&rep->show_threads_values, | 149 | perf_read_values_add_value(&rep->show_threads_values, |