All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 5/9] perf anntoate browser: Fix the toggle total period view to show period, not number of samples
@ 2017-07-19 21:37 Taeung Song
  2017-07-30  9:41 ` [tip:perf/core] perf annotate TUI: Fix --show-total-period tip-bot for Taeung Song
  0 siblings, 1 reply; 2+ messages in thread
From: Taeung Song @ 2017-07-19 21:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Namhyung Kim, Milian Wolff, Jiri Olsa

Currently the toggle total period view on the annotate TUI
shows the number of samples, not period like below.
So fix the toggle total period view on the annotate TUI like below.

  $ perf annotate --show-total-period

Before:

       │    Disassembly of section .text:
       │
       │    0000000000109a90 <_mcount@@GLIBC_2.2.5>:
       │      sub    $0x38,%rsp
     3 │      mov    %rax,(%rsp)
     3 │      mov    %rcx,0x8(%rsp)

After:

           │    Disassembly of section .text:
           │
           │    0000000000109a90 <_mcount@@GLIBC_2.2.5>:
           │      sub    $0x38,%rsp
   2204022 │      mov    %rax,(%rsp)
   2207405 │      mov    %rcx,0x8(%rsp)

Reported-by: Namhyung Kim <namhyung@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/ui/browsers/annotate.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 0be6bee..5ff1799 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -17,7 +17,7 @@
 
 struct disasm_line_samples {
 	double		percent;
-	u64		nr;
+	struct sym_hist_entry sample;
 };
 
 #define IPC_WIDTH 6
@@ -113,6 +113,10 @@ static int annotate_browser__pcnt_width(struct annotate_browser *ab)
 
 	if (ab->have_cycles)
 		w += IPC_WIDTH + CYCLES_WIDTH;
+
+	if (annotate_browser__opts.show_total_period)
+		w += 4 * ab->nr_events;
+
 	return w;
 }
 
@@ -150,8 +154,8 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
 						bdl->samples[i].percent,
 						current_entry);
 			if (annotate_browser__opts.show_total_period) {
-				ui_browser__printf(browser, "%6" PRIu64 " ",
-						   bdl->samples[i].nr);
+				ui_browser__printf(browser, "%10" PRIu64 " ",
+						   bdl->samples[i].sample.period);
 			} else {
 				ui_browser__printf(browser, "%6.2f ",
 						   bdl->samples[i].percent);
@@ -161,7 +165,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
 		ui_browser__set_percent_color(browser, 0, current_entry);
 
 		if (!show_title)
-			ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
+			ui_browser__write_nstring(browser, " ", pcnt_width);
 		else
 			ui_browser__printf(browser, "%*s", 7, "Percent");
 	}
@@ -456,7 +460,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
 						pos->offset,
 						next ? next->offset : len,
 						&path, &sample);
-			bpos->samples[i].nr = sample.nr_samples;
+			bpos->samples[i].sample = sample;
 
 			if (max_percent < bpos->samples[i].percent)
 				max_percent = bpos->samples[i].percent;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf annotate TUI: Fix --show-total-period
  2017-07-19 21:37 [PATCH v3 5/9] perf anntoate browser: Fix the toggle total period view to show period, not number of samples Taeung Song
@ 2017-07-30  9:41 ` tip-bot for Taeung Song
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Taeung Song @ 2017-07-30  9:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, acme, mliska, linux-kernel, mingo, namhyung, milian.wolff,
	hpa, tglx, treeze.taeung

Commit-ID:  29dc267f270a4ad5ae1341e7fdc8539ac7dc907a
Gitweb:     http://git.kernel.org/tip/29dc267f270a4ad5ae1341e7fdc8539ac7dc907a
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Thu, 27 Jul 2017 11:33:20 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 28 Jul 2017 12:53:06 -0300

perf annotate TUI: Fix --show-total-period

We were showing the number of samples, not the total period, fix it.

Reported-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: 0c4a5bcea460 ("perf annotate: Display total number of samples with --show-total-period")
Link: http://lkml.kernel.org/r/1500500223-16753-1-git-send-email-treeze.taeung@gmail.com
[ extracted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 680fff7..c382b1d 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -152,7 +152,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
 						current_entry);
 			if (annotate_browser__opts.show_total_period) {
 				ui_browser__printf(browser, "%6" PRIu64 " ",
-						   bdl->samples[i].he.nr_samples);
+						   bdl->samples[i].he.period);
 			} else {
 				ui_browser__printf(browser, "%6.2f ",
 						   bdl->samples[i].percent);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-30  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 21:37 [PATCH v3 5/9] perf anntoate browser: Fix the toggle total period view to show period, not number of samples Taeung Song
2017-07-30  9:41 ` [tip:perf/core] perf annotate TUI: Fix --show-total-period tip-bot for Taeung Song

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.