linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com
Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com,
	Jin Yao <yao.jin@linux.intel.com>
Subject: [PATCH] perf top: Display the LBR stats in callchain entry
Date: Wed, 31 Oct 2018 19:06:35 +0800	[thread overview]
Message-ID: <1540983995-20462-1-git-send-email-yao.jin@linux.intel.com> (raw)

Perf report has supported the displaying of LBR stats
(such as cycles, predicted%) in callchain entry.

For example,
perf report --branch-history --stdio

--1.01%--intel_idle mwait.h:29
          intel_idle cpufeature.h:164 (cycles:5)
          intel_idle cpufeature.h:164 (predicted:76.4%)
          intel_idle mwait.h:102 (cycles:41)
          intel_idle current.h:15

While perf top has not supported that.

For example,
perf top -a -b --call-graph branch

-   13.86%     0.23%  [kernel]		[k] __x86_indirect_thunk_rax
   - 13.65% __x86_indirect_thunk_rax
      + 1.69% do_syscall_64
      + 1.68% do_select
      + 1.41% ktime_get
      + 0.70% __schedule
      + 0.62% do_sys_poll
        0.58% __x86_indirect_thunk_rax

Actually it's very easy to enable this feature in perf top.

With this patch, the result is:

perf top -a -b --call-graph branch

-   13.58%     0.00%  [kernel]		[k] __x86_indirect_thunk_rax
   - 13.57% __x86_indirect_thunk_rax (predicted:93.9%)
      + 1.78% do_select (cycles:2)
      + 1.68% perf_pmu_disable.part.99 (cycles:1)
      + 1.45% ___sys_recvmsg (cycles:25)
      + 0.81% unix_stream_sendmsg (cycles:18)
      + 0.80% ktime_get (cycles:400)
        0.58% pick_next_task_fair (cycles:47)
      + 0.56% i915_request_retire (cycles:2)
      + 0.52% do_sys_poll (cycles:4)

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/builtin-top.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index d21d875..7691b21 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1420,6 +1420,9 @@ int cmd_top(int argc, const char **argv)
 		}
 	}
 
+	if (opts->branch_stack && callchain_param.enabled)
+		symbol_conf.show_branchflag_count = true;
+
 	sort__mode = SORT_MODE__TOP;
 	/* display thread wants entries to be collapsed in a different tree */
 	perf_hpp_list.need_collapse = 1;
-- 
2.7.4


             reply	other threads:[~2018-10-31  3:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 11:06 Jin Yao [this message]
2018-11-05  0:31 ` [PATCH] perf top: Display the LBR stats in callchain entry Jin, Yao
2018-11-05 13:10   ` Arnaldo Carvalho de Melo
2018-11-05 17:23     ` Arnaldo Carvalho de Melo
2018-11-06 19:14 ` [tip:perf/urgent] " tip-bot for Jin Yao

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=1540983995-20462-1-git-send-email-yao.jin@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@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 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).