Re: [PATCH 7/8] perf script: support physical addresses in script
From: Jiri Olsa
Date: Thu Jan 07 2016 - 04:54:19 EST
On Wed, Jan 06, 2016 at 06:04:36AM -0500, kan.liang@xxxxxxxxx wrote:
> From: Kan Liang <kan.liang@xxxxxxxxx>
>
> perf script print out physical addresses by applying phys_addr.
> Only display physical address when virtual address is selected. The
> physical address will be printed out right after virtual address.
>
> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
> ---
> tools/perf/builtin-script.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index c298cdc..1e292a7 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -58,6 +58,7 @@ enum perf_output_field {
> PERF_OUTPUT_IREGS = 1U << 14,
> PERF_OUTPUT_BRSTACK = 1U << 15,
> PERF_OUTPUT_BRSTACKSYM = 1U << 16,
> + PERF_OUTPUT_PHYS_ADDR = 1U << 17,
> };
>
> struct output_option {
> @@ -81,6 +82,7 @@ struct output_option {
> {.str = "iregs", .field = PERF_OUTPUT_IREGS},
> {.str = "brstack", .field = PERF_OUTPUT_BRSTACK},
> {.str = "brstacksym", .field = PERF_OUTPUT_BRSTACKSYM},
> + {.str = "phys_addr", .field = PERF_OUTPUT_PHYS_ADDR},
> };
>
> /* default set to maintain compatibility with current format */
> @@ -242,6 +244,12 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
> PERF_OUTPUT_ADDR, allow_user_set))
> return -EINVAL;
>
> + if (PRINT_FIELD(PHYS_ADDR) && !PRINT_FIELD(ADDR)) {
> + pr_err("Display of sample physical address"
> + "but sample address is not selected.\n");
> + return -EINVAL;
> + }
hum, why the ADDR matter in here? we have PHYS_ADDR already stored
in perf.data so we should be all set to display it
[jolsa@ibm-x3650m4-01 perf]$ ./perf script -F addr,phys_addr | head -3
ffff8804744e5de9 4744e5de9
ffff88047fca5e90 47fca5e90
ffff8804710cfcb8 4710cfcb8
[jolsa@ibm-x3650m4-01 perf]$ ./perf script -F phys_addr
Display of sample physical addressbut sample address is not selected.
also you need to add extra space behind 'address':
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/