File perf-annotate-tui-set-appropriate-column-width-for-period-percent.patch of Package perf
62
1
From: Arnaldo Carvalho de Melo <acme@redhat.com>
2
Date: Fri, 28 Jul 2017 13:19:32 -0300
3
Subject: perf annotate TUI: Set appropriate column width for period/percent
4
Git-commit: 3861c4a49bea432c57d6e7cbd89c8b71ed4445b7
5
Patch-mainline: v4.14-rc1
6
References: bsc#1070010 (git-fixes - dependency)
7
Signed-off-By: Tony Jones <tonyj@suse.de>
8
9
Either when we start 'perf annotate' or 'perf report' with
10
--show-total-period or when we, in the annotate browser, press 't' to
11
toggle period/percent for the first column, we need to adjust the width
12
for the 'period' case.
13
14
Based-on-a-patch-by: Taeung Song <treeze.taeung@gmail.com>
15
Cc: Adrian Hunter <adrian.hunter@intel.com>
16
Cc: David Ahern <dsahern@gmail.com>
17
Cc: Jiri Olsa <jolsa@kernel.org>
18
Cc: Namhyung Kim <namhyung@kernel.org>
19
Cc: Wang Nan <wangnan0@huawei.com>
20
Link: http://lkml.kernel.org/n/tip-n2np5qcs20u6qjdr9orygne6@git.kernel.org
21
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
22
---
23
tools/perf/ui/browsers/annotate.c | 10 ++++++----
24
1 file changed, 6 insertions(+), 4 deletions(-)
25
26
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
27
index 46f297a4e94b..80f38dab9c3a 100644
28
--- a/tools/perf/ui/browsers/annotate.c
29
+++ b/tools/perf/ui/browsers/annotate.c
30
31
32
static int annotate_browser__pcnt_width(struct annotate_browser *ab)
33
{
34
- return 7 * ab->nr_events;
35
+ return (annotate_browser__opts.show_total_period ? 12 : 7) * ab->nr_events;
36
}
37
38
static int annotate_browser__cycles_width(struct annotate_browser *ab)
39
40
bdl->samples[i].percent,
41
current_entry);
42
if (annotate_browser__opts.show_total_period) {
43
- ui_browser__printf(browser, "%6" PRIu64 " ",
44
+ ui_browser__printf(browser, "%11" PRIu64 " ",
45
bdl->samples[i].he.period);
46
} else {
47
ui_browser__printf(browser, "%6.2f ",
48
49
50
if (!show_title)
51
ui_browser__write_nstring(browser, " ", pcnt_width);
52
- else
53
- ui_browser__printf(browser, "%*s", 7, annotate_browser__opts.show_total_period ? "Period" : "Percent");
54
+ else {
55
+ ui_browser__printf(browser, "%*s", pcnt_width,
56
+ annotate_browser__opts.show_total_period ? "Period" : "Percent");
57
+ }
58
}
59
if (ab->have_cycles) {
60
if (dl->ipc)
61
62