aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-03-22 17:23:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-03-23 11:03:07 -0400
commit473398a21d28c089555117a8db4ea04e371dd03c (patch)
tree23aedcb836ef40362aa4bee4f625352b708fc492 /tools/perf/builtin-script.c
parenteb9f03231b7a27999abe22d3c5f71700338630c6 (diff)
perf tools: Add cpumode to struct perf_sample
To avoid parsing event->header.misc in many locations. This will also allow setting perf.sample.{ip,cpumode} in a single place, from tracepoint fields, as needed by 'perf kvm' with PPC guests, where the guest hardware counters is not available at the host. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Hemant Kumar <hemant@linux.vnet.ibm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-qp3yradhyt6q3wl895b1aat0@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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d04c8e7a9507..928a4411e023 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -498,14 +498,13 @@ static void print_sample_brstack(union perf_event *event __maybe_unused,
498 } 498 }
499} 499}
500 500
501static void print_sample_brstacksym(union perf_event *event, 501static void print_sample_brstacksym(union perf_event *event __maybe_unused,
502 struct perf_sample *sample, 502 struct perf_sample *sample,
503 struct thread *thread __maybe_unused, 503 struct thread *thread __maybe_unused,
504 struct perf_event_attr *attr __maybe_unused) 504 struct perf_event_attr *attr __maybe_unused)
505{ 505{
506 struct branch_stack *br = sample->branch_stack; 506 struct branch_stack *br = sample->branch_stack;
507 struct addr_location alf, alt; 507 struct addr_location alf, alt;
508 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
509 u64 i, from, to; 508 u64 i, from, to;
510 509
511 if (!(br && br->nr)) 510 if (!(br && br->nr))
@@ -518,11 +517,11 @@ static void print_sample_brstacksym(union perf_event *event,
518 from = br->entries[i].from; 517 from = br->entries[i].from;
519 to = br->entries[i].to; 518 to = br->entries[i].to;
520 519
521 thread__find_addr_map(thread, cpumode, MAP__FUNCTION, from, &alf); 520 thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf);
522 if (alf.map) 521 if (alf.map)
523 alf.sym = map__find_symbol(alf.map, alf.addr, NULL); 522 alf.sym = map__find_symbol(alf.map, alf.addr, NULL);
524 523
525 thread__find_addr_map(thread, cpumode, MAP__FUNCTION, to, &alt); 524 thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt);
526 if (alt.map) 525 if (alt.map)
527 alt.sym = map__find_symbol(alt.map, alt.addr, NULL); 526 alt.sym = map__find_symbol(alt.map, alt.addr, NULL);
528 527