aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/hist.c')
-rw-r--r--tools/perf/ui/hist.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 4274969ddc89..37388397b5bc 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -230,13 +230,14 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
230} 230}
231 231
232static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, 232static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
233 struct hists *hists) 233 struct hists *hists, int line __maybe_unused,
234 int *span __maybe_unused)
234{ 235{
235 int len = hpp__width_fn(fmt, hpp, hists); 236 int len = hpp__width_fn(fmt, hpp, hists);
236 return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name); 237 return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
237} 238}
238 239
239static int hpp_color_scnprintf(struct perf_hpp *hpp, const char *fmt, ...) 240int hpp_color_scnprintf(struct perf_hpp *hpp, const char *fmt, ...)
240{ 241{
241 va_list args; 242 va_list args;
242 ssize_t ssize = hpp->size; 243 ssize_t ssize = hpp->size;
@@ -441,6 +442,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
441struct perf_hpp_list perf_hpp_list = { 442struct perf_hpp_list perf_hpp_list = {
442 .fields = LIST_HEAD_INIT(perf_hpp_list.fields), 443 .fields = LIST_HEAD_INIT(perf_hpp_list.fields),
443 .sorts = LIST_HEAD_INIT(perf_hpp_list.sorts), 444 .sorts = LIST_HEAD_INIT(perf_hpp_list.sorts),
445 .nr_header_lines = 1,
444}; 446};
445 447
446#undef HPP__COLOR_PRINT_FNS 448#undef HPP__COLOR_PRINT_FNS
@@ -697,6 +699,21 @@ void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists)
697 } 699 }
698} 700}
699 701
702void hists__reset_column_width(struct hists *hists)
703{
704 struct perf_hpp_fmt *fmt;
705 struct perf_hpp_list_node *node;
706
707 hists__for_each_format(hists, fmt)
708 perf_hpp__reset_width(fmt, hists);
709
710 /* hierarchy entries have their own hpp list */
711 list_for_each_entry(node, &hists->hpp_formats, list) {
712 perf_hpp_list__for_each_format(&node->hpp, fmt)
713 perf_hpp__reset_width(fmt, hists);
714 }
715}
716
700void perf_hpp__set_user_width(const char *width_list_str) 717void perf_hpp__set_user_width(const char *width_list_str)
701{ 718{
702 struct perf_hpp_fmt *fmt; 719 struct perf_hpp_fmt *fmt;