public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: acme@redhat.com, peterz@infradead.org, mingo@elte.hu,
	ak@linux.intel.com, kan.liang@intel.com, jolsa@redhat.com
Subject: [PATCH 5/5] perf/script: add support for skid ip
Date: Thu, 15 Jun 2017 06:56:29 -0700	[thread overview]
Message-ID: <1497534989-29231-6-git-send-email-eranian@google.com> (raw)
In-Reply-To: <1497534989-29231-1-git-send-email-eranian@google.com>

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@google.com>
---
 tools/perf/builtin-script.c | 12 +++++++++++-
 tools/perf/util/session.c   |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 4761b0d7fcb5..ba6720cf70ce 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -85,6 +85,7 @@ enum perf_output_field {
 	PERF_OUTPUT_INSN	    = 1U << 21,
 	PERF_OUTPUT_INSNLEN	    = 1U << 22,
 	PERF_OUTPUT_BRSTACKINSN	    = 1U << 23,
+	PERF_OUTPUT_SKID_IP	    = 1U << 24,
 };
 
 struct output_option {
@@ -115,6 +116,7 @@ struct output_option {
 	{.str = "insn", .field = PERF_OUTPUT_INSN},
 	{.str = "insnlen", .field = PERF_OUTPUT_INSNLEN},
 	{.str = "brstackinsn", .field = PERF_OUTPUT_BRSTACKINSN},
+	{.str = "skid_ip", .field = PERF_OUTPUT_SKID_IP},
 };
 
 /* default set to maintain compatibility with current format */
@@ -1125,6 +1127,11 @@ static size_t data_src__printf(u64 data_src)
 	return printf("%-*s", maxlen, out);
 }
 
+static void print_sample_skid_ip(struct perf_sample *sample)
+{
+	printf(" %"PRIx64" ", sample->skid_ip);
+}
+
 static void process_event(struct perf_script *script,
 			  struct perf_sample *sample, struct perf_evsel *evsel,
 			  struct addr_location *al,
@@ -1193,7 +1200,10 @@ static void process_event(struct perf_script *script,
 
 	if (perf_evsel__is_bpf_output(evsel) && PRINT_FIELD(BPF_OUTPUT))
 		print_sample_bpf_output(sample);
-	print_insn(sample, attr, thread, machine);
+
+	if (PRINT_FIELD(SKID_IP))
+		print_sample_skid_ip(sample);
+
 	printf("\n");
 }
 
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0bfc1051c708..51b90630cb32 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1125,7 +1125,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 struct machine *machines__find_for_cpumode(struct machines *machines,
-- 
2.13.1.518.g3df882009-goog

  parent reply	other threads:[~2017-06-15 13:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 13:56 [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian
2017-06-15 13:56 ` [PATCH 1/5] perf/core: add PERF_SAMPLE_SKID_IP record type Stephane Eranian
2017-06-15 13:56 ` [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86 PEBS Stephane Eranian
2017-06-15 15:40   ` Liang, Kan
2017-06-15 16:39     ` Stephane Eranian
2017-06-15 17:18       ` Liang, Kan
2017-06-15 19:19       ` Stephane Eranian
2017-06-15 13:56 ` [PATCH 3/5] perf/tools: add support for PERF_SAMPLE_SKID_IP Stephane Eranian
2017-06-15 13:56 ` [PATCH 4/5] perf/record: add support for sampling skid ip Stephane Eranian
2017-06-15 13:56 ` Stephane Eranian [this message]
2017-06-15 15:10 ` [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen
2017-06-15 16:44   ` Stephane Eranian
2017-06-15 17:23     ` Andi Kleen
2017-06-15 19:35       ` Stephane Eranian
2017-06-15 20:02         ` Andi Kleen
2017-06-15 20:20           ` Stephane Eranian
2017-06-15 22:28             ` Stephane Eranian
2017-06-15 23:18               ` Andi Kleen
2017-06-16  6:52                 ` Stephane Eranian
2017-06-16 16:06                   ` Andi Kleen
2017-06-16 17:08                     ` Stephane Eranian
2017-06-16 17:12                       ` Stephane Eranian
2017-06-16 17:50                         ` Andi Kleen
2017-06-16 19:15                           ` Stephane Eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497534989-29231-6-git-send-email-eranian@google.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox