aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 9f5fc5492141..ac574ea23917 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -162,19 +162,11 @@ static void print_sample_start(struct perf_sample *sample,
162 162
163static void process_event(union perf_event *event __unused, 163static void process_event(union perf_event *event __unused,
164 struct perf_sample *sample, 164 struct perf_sample *sample,
165 struct perf_evsel *evsel,
165 struct perf_session *session, 166 struct perf_session *session,
166 struct thread *thread) 167 struct thread *thread)
167{ 168{
168 struct perf_event_attr *attr; 169 struct perf_event_attr *attr = &evsel->attr;
169 struct perf_evsel *evsel;
170
171 evsel = perf_evlist__id2evsel(session->evlist, sample->id);
172 if (evsel == NULL) {
173 pr_err("Invalid data. Contains samples with id not in "
174 "its header!\n");
175 return;
176 }
177 attr = &evsel->attr;
178 170
179 if (output_fields[attr->type] == 0) 171 if (output_fields[attr->type] == 0)
180 return; 172 return;
@@ -244,6 +236,7 @@ static char const *input_name = "perf.data";
244 236
245static int process_sample_event(union perf_event *event, 237static int process_sample_event(union perf_event *event,
246 struct perf_sample *sample, 238 struct perf_sample *sample,
239 struct perf_evsel *evsel,
247 struct perf_session *session) 240 struct perf_session *session)
248{ 241{
249 struct thread *thread = perf_session__findnew(session, event->ip.pid); 242 struct thread *thread = perf_session__findnew(session, event->ip.pid);
@@ -264,7 +257,7 @@ static int process_sample_event(union perf_event *event,
264 last_timestamp = sample->time; 257 last_timestamp = sample->time;
265 return 0; 258 return 0;
266 } 259 }
267 scripting_ops->process_event(event, sample, session, thread); 260 scripting_ops->process_event(event, sample, evsel, session, thread);
268 261
269 session->hists.stats.total_period += sample->period; 262 session->hists.stats.total_period += sample->period;
270 return 0; 263 return 0;