linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changbin Du <changbin.du@huawei.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Changbin Du <changbin.du@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>, <linux-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	Thomas Richter <tmricht@linux.ibm.com>, <changbin.du@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH v4 5/5] perf: script: prefer capstone to XED
Date: Sat, 20 Jan 2024 15:26:37 +0800	[thread overview]
Message-ID: <20240120072637.w6stvbdeynppnfa6@M910t> (raw)
In-Reply-To: <adb07ef9-4609-4cb4-b5e4-8e0af00bac16@intel.com>

On Fri, Jan 19, 2024 at 08:40:20PM +0200, Adrian Hunter wrote:
> On 19/01/24 12:48, Changbin Du wrote:
> > Now perf can show assembly instructions with libcapstone for x86, and the
> > capstone is better in general.
> > 
> > Signed-off-by: Changbin Du <changbin.du@huawei.com>
> > ---
> >  tools/perf/Documentation/perf-intel-pt.txt | 11 +++++------
> >  tools/perf/ui/browsers/res_sample.c        |  2 +-
> >  tools/perf/ui/browsers/scripts.c           |  2 +-
> >  3 files changed, 7 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tools/perf/Documentation/perf-intel-pt.txt b/tools/perf/Documentation/perf-intel-pt.txt
> > index 2109690b0d5f..8e62f23f7178 100644
> > --- a/tools/perf/Documentation/perf-intel-pt.txt
> > +++ b/tools/perf/Documentation/perf-intel-pt.txt
> > @@ -115,9 +115,8 @@ toggle respectively.
> >  
> >  perf script also supports higher level ways to dump instruction traces:
> >  
> > -	perf script --insn-trace --xed
> > +	perf script --insn-trace=disasm
> 
> Please add also:
> 
> or to use the xed disassembler, which requires installing the xed tool
> (see XED below):
> 
> 	perf script --insn-trace --xed
>
Added, thanks.

> >  
> > -Dump all instructions. This requires installing the xed tool (see XED below)
> >  Dumping all instructions in a long trace can be fairly slow. It is usually better
> >  to start with higher level decoding, like
> >  
> > @@ -130,12 +129,12 @@ or
> >  and then select a time range of interest. The time range can then be examined
> >  in detail with
> >  
> > -	perf script --time starttime,stoptime --insn-trace --xed
> > +	perf script --time starttime,stoptime --insn-trace=disasm
> >  
> >  While examining the trace it's also useful to filter on specific CPUs using
> >  the -C option
> >  
> > -	perf script --time starttime,stoptime --insn-trace --xed -C 1
> > +	perf script --time starttime,stoptime --insn-trace=disasm -C 1
> >  
> >  Dump all instructions in time range on CPU 1.
> >  
> > @@ -1306,7 +1305,7 @@ Without timestamps, --per-thread must be specified to distinguish threads.
> >  
> >  perf script can be used to provide an instruction trace
> >  
> > - $ perf script --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21
> > + $ perf script --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21
> >         CPU 0/KVM  1440  ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms])                movq  0x48(%rax), %r9
> >         CPU 0/KVM  1440  ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms])                movq  0x50(%rax), %r10
> >         CPU 0/KVM  1440  ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms])                movq  0x58(%rax), %r11
> > @@ -1407,7 +1406,7 @@ There were none.
> >  
> >  'perf script' can be used to provide an instruction trace showing timestamps
> >  
> > - $ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21
> > + $ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21
> >         CPU 1/KVM 17006 [001] 11500.262865593:  ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms])                 movq  0x48(%rax), %r9
> >         CPU 1/KVM 17006 [001] 11500.262865593:  ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms])                 movq  0x50(%rax), %r10
> >         CPU 1/KVM 17006 [001] 11500.262865593:  ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms])                 movq  0x58(%rax), %r11
> > diff --git a/tools/perf/ui/browsers/res_sample.c b/tools/perf/ui/browsers/res_sample.c
> > index 7cb2d6678039..1022baefaf45 100644
> > --- a/tools/perf/ui/browsers/res_sample.c
> > +++ b/tools/perf/ui/browsers/res_sample.c
> > @@ -83,7 +83,7 @@ int res_sample_browse(struct res_sample *res_samples, int num_res,
> >  		     r->tid ? "--tid " : "",
> >  		     r->tid ? (sprintf(tidbuf, "%d", r->tid), tidbuf) : "",
> >  		     extra_format,
> > -		     rstype == A_ASM ? "-F +insn --xed" :
> > +		     rstype == A_ASM ? "-F +insn_disasm" :
> 
> insn_disasm -> disasm
>
Fixed. I forgot to commit this change for last version.

> >  		     rstype == A_SOURCE ? "-F +srcline,+srccode" : "",
> >  		     symbol_conf.inline_name ? "--inline" : "",
> >  		     "--show-lost-events ",
> > diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
> > index 47d2c7a8cbe1..3efc76c621c4 100644
> > --- a/tools/perf/ui/browsers/scripts.c
> > +++ b/tools/perf/ui/browsers/scripts.c
> > @@ -107,7 +107,7 @@ static int list_scripts(char *script_name, bool *custom,
> >  	if (evsel)
> >  		attr_to_script(scriptc.extra_format, &evsel->core.attr);
> >  	add_script_option("Show individual samples", "", &scriptc);
> > -	add_script_option("Show individual samples with assembler", "-F +insn --xed",
> > +	add_script_option("Show individual samples with assembler", "-F +insn_disasm",
> 
> insn_disasm -> disasm
>
Fixed.

> >  			  &scriptc);
> >  	add_script_option("Show individual samples with source", "-F +srcline,+srccode",
> >  			  &scriptc);
> 

-- 
Cheers,
Changbin Du

      reply	other threads:[~2024-01-20  7:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 10:48 [PATCH v4 0/5] perf: script: Intro capstone disasm engine to show instruction trace Changbin Du
2024-01-19 10:48 ` [PATCH v4 1/5] perf: build: introduce the libcapstone Changbin Du
2024-01-19 18:38   ` Adrian Hunter
2024-01-20  7:23     ` Changbin Du
2024-01-19 10:48 ` [PATCH v4 2/5] perf: util: use capstone disasm engine to show assembly instructions Changbin Du
2024-01-19 18:39   ` Adrian Hunter
2024-01-20  9:13     ` Changbin Du
2024-01-22  8:24       ` Adrian Hunter
2024-01-22  8:42         ` Changbin Du
2024-01-19 10:48 ` [PATCH v4 3/5] perf: script: add field 'disasm' to display mnemonic instructions Changbin Du
2024-01-19 18:39   ` Adrian Hunter
2024-01-20  7:40     ` Changbin Du
2024-01-22  9:59       ` Adrian Hunter
2024-01-22 10:46         ` Changbin Du
2024-01-22 13:41           ` Andi Kleen
2024-01-22 14:05             ` Changbin Du
2024-01-19 10:48 ` [PATCH v4 4/5] perf: script: add raw|disasm arguments to --insn-trace option Changbin Du
2024-01-19 18:39   ` Adrian Hunter
2024-01-20  7:30     ` Changbin Du
2024-01-19 10:48 ` [PATCH v4 5/5] perf: script: prefer capstone to XED Changbin Du
2024-01-19 18:40   ` Adrian Hunter
2024-01-20  7:26     ` Changbin Du [this message]

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=20240120072637.w6stvbdeynppnfa6@M910t \
    --to=changbin.du@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=changbin.du@gmail.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tmricht@linux.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).