perf annotate TUI: Clarify calculation of column header widths
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 27 Jul 2017 15:05:58 +0000 (12:05 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 28 Jul 2017 15:53:07 +0000 (12:53 -0300)
commitbc1e5d60cebb711ca3783a87a969d18db376d357
tree2d0b19b14ce107efef214858f282089d57e9cf5c
parent29dc267f270a4ad5ae1341e7fdc8539ac7dc907a
perf annotate TUI: Clarify calculation of column header widths

In commit f8f4aaead579 ("perf annotate: Finally display IPC and cycle
accounting") the 'pcnt_width' variable was abused in a few places to
also include the optional width of the "IPC" and "cycles" columns, while
in other places we stopped using 'pcnt_width' and instead its previous
equation...

Now that we need to tap into annotate_browser__pcnt_width() to consider
if --show-total-period is being used and instead of that hardcoded 7
(strlen("Percent")) we need to use it or strlen("Event count") we need
this properly clarified to avoid having to touch all the (7 * nr_events)
places.

Clarify this by introducing a separate annotate_browser__cycles_width()
to leave the pcnt_width calculate just what its name implies.

Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/n/tip-szgb07t4k5wtvks8nzwkg710@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/browsers/annotate.c