aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 04:56:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 07:39:12 -0500
commit743eb868657bdb1b26c7b24077ca21c67c82c777 (patch)
tree4803b557725213043ccd5d3f83d2eec796a49f69 /tools/perf/builtin-script.c
parentd20deb64e0490ee9442b5181bc08a62d2cadcb90 (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-script.c')
-rw-r--r--tools/perf/builtin-script.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 3b7820612ebf..31a8d14e5fb7 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -315,7 +315,7 @@ static bool sample_addr_correlates_sym(struct perf_event_attr *attr)
315 315
316static void print_sample_addr(union perf_event *event, 316static void print_sample_addr(union perf_event *event,
317 struct perf_sample *sample, 317 struct perf_sample *sample,
318 struct perf_session *session, 318 struct machine *machine,
319 struct thread *thread, 319 struct thread *thread,
320 struct perf_event_attr *attr) 320 struct perf_event_attr *attr)
321{ 321{
@@ -328,11 +328,11 @@ static void print_sample_addr(union perf_event *event,
328 if (!sample_addr_correlates_sym(attr)) 328 if (!sample_addr_correlates_sym(attr))
329 return; 329 return;
330 330
331 thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION, 331 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
332 event->ip.pid, sample->addr, &al); 332 sample->addr, &al);
333 if (!al.map) 333 if (!al.map)
334 thread__find_addr_map(thread, session, cpumode, MAP__VARIABLE, 334 thread__find_addr_map(thread, machine, cpumode, MAP__VARIABLE,
335 event->ip.pid, sample->addr, &al); 335 sample->addr, &al);
336 336
337 al.cpu = sample->cpu; 337 al.cpu = sample->cpu;
338 al.sym = NULL; 338 al.sym = NULL;
@@ -362,7 +362,7 @@ static void print_sample_addr(union perf_event *event,
362static void process_event(union perf_event *event __unused, 362static void process_event(union perf_event *event __unused,
363 struct perf_sample *sample, 363 struct perf_sample *sample,
364 struct perf_evsel *evsel, 364 struct perf_evsel *evsel,
365 struct perf_session *session, 365 struct machine *machine,
366 struct thread *thread) 366 struct thread *thread)
367{ 367{
368 struct perf_event_attr *attr = &evsel->attr; 368 struct perf_event_attr *attr = &evsel->attr;
@@ -377,15 +377,15 @@ static void process_event(union perf_event *event __unused,
377 sample->raw_size); 377 sample->raw_size);
378 378
379 if (PRINT_FIELD(ADDR)) 379 if (PRINT_FIELD(ADDR))
380 print_sample_addr(event, sample, session, thread, attr); 380 print_sample_addr(event, sample, machine, thread, attr);
381 381
382 if (PRINT_FIELD(IP)) { 382 if (PRINT_FIELD(IP)) {
383 if (!symbol_conf.use_callchain) 383 if (!symbol_conf.use_callchain)
384 printf(" "); 384 printf(" ");
385 else 385 else
386 printf("\n"); 386 printf("\n");
387 perf_session__print_ip(event, evsel, sample, session, 387 perf_event__print_ip(event, sample, machine, evsel,
388 PRINT_FIELD(SYM), PRINT_FIELD(DSO)); 388 PRINT_FIELD(SYM), PRINT_FIELD(DSO));
389 } 389 }
390 390
391 printf("\n"); 391 printf("\n");
@@ -438,9 +438,9 @@ static int process_sample_event(struct perf_event_ops *ops __used,
438 union perf_event *event, 438 union perf_event *event,
439 struct perf_sample *sample, 439 struct perf_sample *sample,
440 struct perf_evsel *evsel, 440 struct perf_evsel *evsel,
441 struct perf_session *session) 441 struct machine *machine)
442{ 442{
443 struct thread *thread = perf_session__findnew(session, event->ip.pid); 443 struct thread *thread = machine__findnew_thread(machine, event->ip.pid);
444 444
445 if (thread == NULL) { 445 if (thread == NULL) {
446 pr_debug("problem processing %d event, skipping it.\n", 446 pr_debug("problem processing %d event, skipping it.\n",
@@ -462,9 +462,9 @@ static int process_sample_event(struct perf_event_ops *ops __used,
462 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) 462 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
463 return 0; 463 return 0;
464 464
465 scripting_ops->process_event(event, sample, evsel, session, thread); 465 scripting_ops->process_event(event, sample, evsel, machine, thread);
466 466
467 session->hists.stats.total_period += sample->period; 467 evsel->hists.stats.total_period += sample->period;
468 return 0; 468 return 0;
469} 469}
470 470