From ee757d4db65a27998c708a4d27674842f7db9f53 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 21 Jul 2010 17:58:25 -0300 Subject: [PATCH] --- yaml --- r: 205333 b: refs/heads/master c: 06daaaba7c211ca6a8227b9a54dbc86dd837f034 h: refs/heads/master i: 205331: 6b6021a491e898a85d472f239ca8507eae55f4cf v: v3 --- [refs] | 2 +- trunk/tools/perf/util/hist.c | 27 +++++++++++++++++++++++++++ trunk/tools/perf/util/hist.h | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 397613cb4c44..e547055baeba 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b61b55ed995fd2765cd4ec0b22f0348dee272070 +refs/heads/master: 06daaaba7c211ca6a8227b9a54dbc86dd837f034 diff --git a/trunk/tools/perf/util/hist.c b/trunk/tools/perf/util/hist.c index 0bc67900352c..f93095ffaab0 100644 --- a/trunk/tools/perf/util/hist.c +++ b/trunk/tools/perf/util/hist.c @@ -850,6 +850,33 @@ size_t hists__fprintf(struct hists *self, struct hists *pair, return ret; } +/* + * See hists__fprintf to match the column widths + */ +unsigned int hists__sort_list_width(struct hists *self) +{ + struct sort_entry *se; + int ret = 9; /* total % */ + + if (symbol_conf.show_cpu_utilization) { + ret += 7; /* count_sys % */ + ret += 6; /* count_us % */ + if (perf_guest) { + ret += 13; /* count_guest_sys % */ + ret += 12; /* count_guest_us % */ + } + } + + if (symbol_conf.show_nr_samples) + ret += 11; + + list_for_each_entry(se, &hist_entry__sort_list, list) + if (!se->elide) + ret += 2 + hists__col_len(self, se->se_width_idx); + + return ret; +} + static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h, enum hist_filter filter) { diff --git a/trunk/tools/perf/util/hist.h b/trunk/tools/perf/util/hist.h index 92962b2f579b..65a48db46a29 100644 --- a/trunk/tools/perf/util/hist.h +++ b/trunk/tools/perf/util/hist.h @@ -141,4 +141,7 @@ int hist_entry__tui_annotate(struct hist_entry *self); int hists__tui_browse_tree(struct rb_root *self, const char *help); #endif + +unsigned int hists__sort_list_width(struct hists *self); + #endif /* __PERF_HIST_H */