[PATCH v2 5/5] perf/script: add support for skid ip

From: Stephane Eranian
Date: Thu Nov 02 2017 - 14:16:20 EST


From: Stephane Eranian <eranian@xxxxxxxxx>

This patch adds a skid_ip field to perf script
to dump the raw value of the PERF_SAMPLE_SKID_IP
field in each sample.

$ perf script -F +ip,+skid_ip ......

Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
---
tools/perf/builtin-script.c | 6 ++++++
tools/perf/util/session.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index a3add2cd7856..a13fbc13373b 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -89,6 +89,7 @@ enum perf_output_field {
PERF_OUTPUT_SYNTH = 1U << 25,
PERF_OUTPUT_PHYS_ADDR = 1U << 26,
PERF_OUTPUT_UREGS = 1U << 27,
+ PERF_OUTPUT_SKID_IP = 1U << 28,
};

struct output_option {
@@ -123,6 +124,7 @@ struct output_option {
{.str = "brstackoff", .field = PERF_OUTPUT_BRSTACKOFF},
{.str = "synth", .field = PERF_OUTPUT_SYNTH},
{.str = "phys_addr", .field = PERF_OUTPUT_PHYS_ADDR},
+ {.str = "skid_ip", .field = PERF_OUTPUT_SKID_IP},
};

enum {
@@ -1514,6 +1516,10 @@ static void process_event(struct perf_script *script,

if (PRINT_FIELD(PHYS_ADDR))
printf("%16" PRIx64, sample->phys_addr);
+
+ if (PRINT_FIELD(SKID_IP))
+ printf(" %"PRIx64" ", sample->skid_ip);
+
printf("\n");
}

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 9390cedee6f4..802227735a89 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1132,7 +1132,7 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
sample_read__printf(sample, evsel->attr.read_format);

if (sample_type & PERF_SAMPLE_SKID_IP)
- printf("... skid_ip: %" PRIu64 "\n", sample->skid_ip);
+ printf("... skid_ip: 0x%" PRIx64 "\n", sample->skid_ip);
}

static void dump_read(struct perf_evsel *evsel, union perf_event *event)
--
2.7.4