All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: "Clark Williams" <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
	"Andi Kleen" <ak@linux.intel.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"David Ahern" <dsahern@gmail.com>,
	"Jin Yao" <yao.jin@linux.intel.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Martin Liška" <mliska@suse.cz>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Ravi Bangoria" <ravi.bangoria@linux.vnet.ibm.com>,
	"Thomas Richter" <tmricht@linux.vnet.ibm.com>,
	"Wang Nan" <wangnan0@huawei.com>
Subject: [PATCH 05/17] perf annotate browser: Allow showing offsets in more than just jump targets
Date: Fri, 13 Apr 2018 11:00:59 -0300	[thread overview]
Message-ID: <20180413140111.25313-6-acme@kernel.org> (raw)
In-Reply-To: <20180413140111.25313-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Jesper wanted to see offsets at callq sites when doing some performance
investigation related to retpolines, so save him some time by providing
a 'O' hotkey to allow showing offsets from function start at call
instructions or in all instructions, just go on pressing 'O' till the
offsets you need appear.

Example:

Starts with:

Samples: 64  of event 'cycles:ppp', 100000 Hz, Event count (approx.): 318963
ixgbe_read_reg  /proc/kcore
Percent│    ↑ je     2a
       │   ┌──cmp    $0xffffffff,%r13d
       │   ├──je     d0
       │   │  mov    $0x53e3,%edi
       │   │→ callq  __const_udelay
       │   │  sub    $0x1,%r15d
       │   │↑ jne    83
       │   │  mov    0x8(%rbp),%rax
       │   │  testb  $0x20,0x1799(%rax)
       │   │↑ je     2a
       │   │  mov    0x200(%rax),%rdi
       │   │  mov    %r13d,%edx
       │   │  mov    $0xffffffffc02595d8,%rsi
       │   │→ callq  netdev_warn
       │   │↑ jmpq   2a
       │d0:└─→mov    0x8(%rbp),%rsi
       │      mov    %rbp,%rdi
       │      mov    %eax,0x4(%rsp)
       │    → callq  ixgbe_remove_adapter.isra.77
       │      mov    0x4(%rsp),%eax
Press 'h' for help on key bindings
============================================================================

Pess 'O':

Samples: 64  of event 'cycles:ppp', 100000 Hz, Event count (approx.): 318963
ixgbe_read_reg  /proc/kcore
Percent│    ↑ je     2a
       │   ┌──cmp    $0xffffffff,%r13d
       │   ├──je     d0
       │   │  mov    $0x53e3,%edi
       │99:│→ callq  __const_udelay
       │   │  sub    $0x1,%r15d
       │   │↑ jne    83
       │   │  mov    0x8(%rbp),%rax
       │   │  testb  $0x20,0x1799(%rax)
       │   │↑ je     2a
       │   │  mov    0x200(%rax),%rdi
       │   │  mov    %r13d,%edx
       │   │  mov    $0xffffffffc02595d8,%rsi
       │c6:│→ callq  netdev_warn
       │   │↑ jmpq   2a
       │d0:└─→mov    0x8(%rbp),%rsi
       │      mov    %rbp,%rdi
       │      mov    %eax,0x4(%rsp)
       │db: → callq  ixgbe_remove_adapter.isra.77
       │      mov    0x4(%rsp),%eax
Press 'h' for help on key bindings
============================================================================

Press 'O' again:

Samples: 64  of event 'cycles:ppp', 100000 Hz, Event count (approx.): 318963
ixgbe_read_reg  /proc/kcore
Percent│8c: ↑ je     2a
       │8e:┌──cmp    $0xffffffff,%r13d
       │92:├──je     d0
       │94:│  mov    $0x53e3,%edi
       │99:│→ callq  __const_udelay
       │9e:│  sub    $0x1,%r15d
       │a2:│↑ jne    83
       │a4:│  mov    0x8(%rbp),%rax
       │a8:│  testb  $0x20,0x1799(%rax)
       │af:│↑ je     2a
       │b5:│  mov    0x200(%rax),%rdi
       │bc:│  mov    %r13d,%edx
       │bf:│  mov    $0xffffffffc02595d8,%rsi
       │c6:│→ callq  netdev_warn
       │cb:│↑ jmpq   2a
       │d0:└─→mov    0x8(%rbp),%rsi
       │d4:   mov    %rbp,%rdi
       │d7:   mov    %eax,0x4(%rsp)
       │db: → callq  ixgbe_remove_adapter.isra.77
       │e0:   mov    0x4(%rsp),%eax
Press 'h' for help on key bindings
============================================================================

Press 'O' again and it will show just jump target offsets.

Suggested-by: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Liška <mliska@suse.cz>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-upp6pfdetwlsx18ec2uf1od4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/annotate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 12c099a87f8b..3781d74088a7 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -692,6 +692,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
 		"J             Toggle showing number of jump sources on targets\n"
 		"n             Search next string\n"
 		"o             Toggle disassembler output/simplified view\n"
+		"O             Bump offset level (jump targets -> +call -> all -> cycle thru)\n"
 		"s             Toggle source code view\n"
 		"t             Circulate percent, total period, samples view\n"
 		"/             Search string\n"
@@ -719,6 +720,10 @@ static int annotate_browser__run(struct annotate_browser *browser,
 			notes->options->use_offset = !notes->options->use_offset;
 			annotation__update_column_widths(notes);
 			continue;
+		case 'O':
+			if (++notes->options->offset_level > ANNOTATION__MAX_OFFSET_LEVEL)
+				notes->options->offset_level = ANNOTATION__MIN_OFFSET_LEVEL;
+			continue;
 		case 'j':
 			notes->options->jump_arrows = !notes->options->jump_arrows;
 			continue;
-- 
2.14.3

  parent reply	other threads:[~2018-04-13 14:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180413140111.25313-1-acme@kernel.org>
2018-04-13 14:00 ` [PATCH 01/17] perf stat: Enable 1ms interval for printing event counters values Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 02/17] tools headers: Restore READ_ONCE() C++ compatibility Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 03/17] perf tests: Run dwarf unwind test on arm32 Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 04/17] perf annotate: Allow showing offsets in more than just jump targets Arnaldo Carvalho de Melo
2018-04-13 14:00 ` Arnaldo Carvalho de Melo [this message]
2018-04-13 14:01 ` [PATCH 06/17] perf jvmti: Give hints about package names needed to build Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 07/17] perf tests bpf: Remove unused ptrace.h include from LLVM test Arnaldo Carvalho de Melo
2018-04-13 14:01   ` Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 08/17] Revert "x86/asm: Allow again using asm.h when building for the 'bpf' clang target" Arnaldo Carvalho de Melo
2018-04-13 14:01   ` Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 10/17] perf tools: Rename HAVE_SYSCALL_TABLE to HAVE_SYSCALL_TABLE_SUPPORT Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 11/17] perf version: Print status for syscall_table Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 12/17] perf sched: Fix documentation for timehist Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 13/17] perf tests: Disable breakpoint accounting test for powerpc Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 14/17] perf record: Change warning for missing sysfs entry to debug Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 15/17] perf report: Fix switching to another perf.data file Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 16/17] perf annotate: Allow setting the offset level in .perfconfig Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 17/17] perf annotate: Handle variables in 'sub', 'or' and many other instructions Arnaldo Carvalho de Melo
2018-04-13 16:20   ` Andi Kleen
2018-04-13 17:20     ` Arnaldo Carvalho de Melo
2018-04-13 17:39       ` Andi Kleen
2018-04-17  2:56         ` Namhyung Kim
2018-04-17 12:51           ` Arnaldo Carvalho de Melo

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=20180413140111.25313-6-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mliska@suse.cz \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@linux.vnet.ibm.com \
    --cc=tmricht@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=wangnan0@huawei.com \
    --cc=williams@redhat.com \
    --cc=yao.jin@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.