diff options
author | Kan Liang <kan.liang@intel.com> | 2017-08-29 13:11:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-09-01 13:46:29 -0400 |
commit | 49d58f04eb6cdc18b3747fc4243a7114364f5420 (patch) | |
tree | 0572e74e490667f9ce81ff8077a10ed2af7674c9 /tools/perf/builtin-script.c | |
parent | c35aeb9dfe512422ca9ea28aae692c8f1d052b2d (diff) |
perf script: Support physical address
Display the physical address at the tail if it is available.
Signed-off-by: Kan Liang <kan.liang@intel.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1504026672-7304-5-git-send-email-kan.liang@intel.com
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.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 378f76cdf923..3d4c3b5e1868 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -87,6 +87,7 @@ enum perf_output_field { | |||
87 | PERF_OUTPUT_BRSTACKINSN = 1U << 23, | 87 | PERF_OUTPUT_BRSTACKINSN = 1U << 23, |
88 | PERF_OUTPUT_BRSTACKOFF = 1U << 24, | 88 | PERF_OUTPUT_BRSTACKOFF = 1U << 24, |
89 | PERF_OUTPUT_SYNTH = 1U << 25, | 89 | PERF_OUTPUT_SYNTH = 1U << 25, |
90 | PERF_OUTPUT_PHYS_ADDR = 1U << 26, | ||
90 | }; | 91 | }; |
91 | 92 | ||
92 | struct output_option { | 93 | struct output_option { |
@@ -119,6 +120,7 @@ struct output_option { | |||
119 | {.str = "brstackinsn", .field = PERF_OUTPUT_BRSTACKINSN}, | 120 | {.str = "brstackinsn", .field = PERF_OUTPUT_BRSTACKINSN}, |
120 | {.str = "brstackoff", .field = PERF_OUTPUT_BRSTACKOFF}, | 121 | {.str = "brstackoff", .field = PERF_OUTPUT_BRSTACKOFF}, |
121 | {.str = "synth", .field = PERF_OUTPUT_SYNTH}, | 122 | {.str = "synth", .field = PERF_OUTPUT_SYNTH}, |
123 | {.str = "phys_addr", .field = PERF_OUTPUT_PHYS_ADDR}, | ||
122 | }; | 124 | }; |
123 | 125 | ||
124 | enum { | 126 | enum { |
@@ -175,7 +177,8 @@ static struct { | |||
175 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 177 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
176 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | | 178 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | |
177 | PERF_OUTPUT_PERIOD | PERF_OUTPUT_ADDR | | 179 | PERF_OUTPUT_PERIOD | PERF_OUTPUT_ADDR | |
178 | PERF_OUTPUT_DATA_SRC | PERF_OUTPUT_WEIGHT, | 180 | PERF_OUTPUT_DATA_SRC | PERF_OUTPUT_WEIGHT | |
181 | PERF_OUTPUT_PHYS_ADDR, | ||
179 | 182 | ||
180 | .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, | 183 | .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, |
181 | }, | 184 | }, |
@@ -382,6 +385,11 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, | |||
382 | PERF_OUTPUT_IREGS)) | 385 | PERF_OUTPUT_IREGS)) |
383 | return -EINVAL; | 386 | return -EINVAL; |
384 | 387 | ||
388 | if (PRINT_FIELD(PHYS_ADDR) && | ||
389 | perf_evsel__check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", | ||
390 | PERF_OUTPUT_PHYS_ADDR)) | ||
391 | return -EINVAL; | ||
392 | |||
385 | return 0; | 393 | return 0; |
386 | } | 394 | } |
387 | 395 | ||
@@ -1446,6 +1454,9 @@ static void process_event(struct perf_script *script, | |||
1446 | if (perf_evsel__is_bpf_output(evsel) && PRINT_FIELD(BPF_OUTPUT)) | 1454 | if (perf_evsel__is_bpf_output(evsel) && PRINT_FIELD(BPF_OUTPUT)) |
1447 | print_sample_bpf_output(sample); | 1455 | print_sample_bpf_output(sample); |
1448 | print_insn(sample, attr, thread, machine); | 1456 | print_insn(sample, attr, thread, machine); |
1457 | |||
1458 | if (PRINT_FIELD(PHYS_ADDR)) | ||
1459 | printf("%16" PRIx64, sample->phys_addr); | ||
1449 | printf("\n"); | 1460 | printf("\n"); |
1450 | } | 1461 | } |
1451 | 1462 | ||
@@ -2729,7 +2740,7 @@ int cmd_script(int argc, const char **argv) | |||
2729 | "Valid types: hw,sw,trace,raw,synth. " | 2740 | "Valid types: hw,sw,trace,raw,synth. " |
2730 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," | 2741 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," |
2731 | "addr,symoff,period,iregs,brstack,brstacksym,flags," | 2742 | "addr,symoff,period,iregs,brstack,brstacksym,flags," |
2732 | "bpf-output,callindent,insn,insnlen,brstackinsn,synth", | 2743 | "bpf-output,callindent,insn,insnlen,brstackinsn,synth,phys_addr", |
2733 | parse_output_fields), | 2744 | parse_output_fields), |
2734 | OPT_BOOLEAN('a', "all-cpus", &system_wide, | 2745 | OPT_BOOLEAN('a', "all-cpus", &system_wide, |
2735 | "system-wide collection from all CPUs"), | 2746 | "system-wide collection from all CPUs"), |