From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Andi Kleen <ak@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 11/11] perf intel-pt: Add support for decoding PSB+ only
Date: Thu, 9 Jul 2020 20:36:28 +0300 [thread overview]
Message-ID: <20200709173628.5613-12-adrian.hunter@intel.com> (raw)
In-Reply-To: <20200709173628.5613-1-adrian.hunter@intel.com>
A single q option decodes ip from only FUP/TIP packets. Make it so that
repeating the q option (i.e. qq) decodes only PSB+, getting ip if there is
a FUP packet within PSB+ (i.e. between PSB and PSBEND).
Example:
$ perf record -e intel_pt//u grep -rI pudding drivers
[ perf record: Woken up 52 times to write data ]
[ perf record: Captured and wrote 57.870 MB perf.data ]
$ time perf script --itrace=bi | wc -l
58948289
real 1m23.863s
user 1m23.251s
sys 0m7.452s
$ time perf script --itrace=biq | wc -l
3385694
real 0m4.453s
user 0m4.455s
sys 0m0.328s
$ time perf script --itrace=biqq | wc -l
1883
real 0m0.047s
user 0m0.043s
sys 0m0.009s
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/Documentation/perf-intel-pt.txt | 3 +++
.../util/intel-pt-decoder/intel-pt-decoder.c | 18 ++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/tools/perf/Documentation/perf-intel-pt.txt b/tools/perf/Documentation/perf-intel-pt.txt
index 758295a7e3d6..849474629fe7 100644
--- a/tools/perf/Documentation/perf-intel-pt.txt
+++ b/tools/perf/Documentation/perf-intel-pt.txt
@@ -973,6 +973,9 @@ useful only if the control flow of interest is represented or indicated by FUP,
TIP, TIP.PGE, or TIP.PGD packets. However the q option could be used to find
time ranges that could then be decoded fully using the --time option.
+Repeating the q option (i.e. qq) decodes only PSB+, getting ip if there is a
+FUP packet within PSB+ (i.e. between PSB and PSBEND).
+
dump option
~~~~~~~~~~~
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index ccb204b1a050..697513f35154 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -113,6 +113,7 @@ struct intel_pt_decoder {
bool in_psb;
bool hop;
bool hop_psb_fup;
+ bool leap;
enum intel_pt_param_flags flags;
uint64_t pos;
uint64_t last_ip;
@@ -240,6 +241,7 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct intel_pt_params *params)
decoder->return_compression = params->return_compression;
decoder->branch_enable = params->branch_enable;
decoder->hop = params->quick >= 1;
+ decoder->leap = params->quick >= 2;
decoder->flags = params->flags;
@@ -1903,9 +1905,18 @@ static int intel_pt_resample(struct intel_pt_decoder *decoder)
#define HOP_RETURN 2
#define HOP_AGAIN 3
+static int intel_pt_scan_for_psb(struct intel_pt_decoder *decoder);
+
/* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */
static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err)
{
+ /* Leap from PSB to PSB, getting ip from FUP within PSB+ */
+ if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) {
+ *err = intel_pt_scan_for_psb(decoder);
+ if (*err)
+ return HOP_RETURN;
+ }
+
switch (decoder->packet.type) {
case INTEL_PT_TNT:
return HOP_IGNORE;
@@ -2681,6 +2692,7 @@ static int intel_pt_sync(struct intel_pt_decoder *decoder)
decoder->ip = 0;
intel_pt_clear_stack(&decoder->stack);
+leap:
err = intel_pt_scan_for_psb(decoder);
if (err)
return err;
@@ -2702,6 +2714,12 @@ static int intel_pt_sync(struct intel_pt_decoder *decoder)
decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
else
decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
+ } else if (decoder->leap) {
+ /*
+ * In leap mode, only PSB+ is decoded, so keeping leaping to the
+ * next PSB until there is an ip.
+ */
+ goto leap;
} else {
return intel_pt_sync_ip(decoder);
}
--
2.25.1
next prev parent reply other threads:[~2020-07-09 17:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 17:36 [PATCH 00/11] perf intel-pt: Add support for decoding FUP/TIP only Adrian Hunter
2020-07-09 17:36 ` [PATCH 01/11] perf intel-pt: Fix FUP packet state Adrian Hunter
2020-07-09 17:36 ` [PATCH 02/11] perf intel-pt: Fix duplicate branch after CBR Adrian Hunter
2020-07-09 17:36 ` [PATCH 03/11] perf tools: Improve aux_output not supported error Adrian Hunter
2020-07-09 17:36 ` [PATCH 04/11] perf auxtrace: Add optional error flags to the itrace 'e' option Adrian Hunter
2020-07-09 17:36 ` [PATCH 05/11] perf intel-pt: Use itrace error flags to suppress some errors Adrian Hunter
2020-07-09 17:50 ` Andi Kleen
2020-07-09 18:13 ` Adrian Hunter
2020-07-09 18:22 ` Adrian Hunter
2020-07-20 22:18 ` Andi Kleen
2020-07-09 17:36 ` [PATCH 06/11] perf auxtrace: Add optional log flags to the itrace 'd' option Adrian Hunter
2020-07-09 17:51 ` Andi Kleen
2020-07-09 17:36 ` [PATCH 07/11] perf intel-pt: Use itrace debug log flags to suppress some messages Adrian Hunter
2020-07-09 17:36 ` [PATCH 08/11] perf intel-pt: Time filter logged perf events Adrian Hunter
2020-07-09 17:36 ` [PATCH 09/11] perf auxtrace: Add itrace 'q' option for quicker, less detailed decoding Adrian Hunter
2020-07-09 17:52 ` Andi Kleen
2020-07-09 17:36 ` [PATCH 10/11] perf intel-pt: Add support for decoding FUP/TIP only Adrian Hunter
2020-07-09 17:55 ` Andi Kleen
2020-07-09 17:36 ` Adrian Hunter [this message]
2020-07-09 17:59 ` [PATCH 11/11] perf intel-pt: Add support for decoding PSB+ only Andi Kleen
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=20200709173628.5613-12-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.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