diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-21 16:58:25 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-27 10:24:31 -0400 |
| commit | 06daaaba7c211ca6a8227b9a54dbc86dd837f034 (patch) | |
| tree | a05215f48fd55b8afe4ada29fb4de623372845c8 | |
| parent | b61b55ed995fd2765cd4ec0b22f0348dee272070 (diff) | |
perf hist: Introduce routine to measure lenght of formatted entry
Will be used to figure out the window width needed in the new tree
widget.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/util/hist.c | 27 | ||||
| -rw-r--r-- | tools/perf/util/hist.h | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 0bc67900352c..f93095ffaab0 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -850,6 +850,33 @@ print_entries: | |||
| 850 | return ret; | 850 | return ret; |
| 851 | } | 851 | } |
| 852 | 852 | ||
| 853 | /* | ||
| 854 | * See hists__fprintf to match the column widths | ||
| 855 | */ | ||
| 856 | unsigned int hists__sort_list_width(struct hists *self) | ||
| 857 | { | ||
| 858 | struct sort_entry *se; | ||
| 859 | int ret = 9; /* total % */ | ||
| 860 | |||
| 861 | if (symbol_conf.show_cpu_utilization) { | ||
| 862 | ret += 7; /* count_sys % */ | ||
| 863 | ret += 6; /* count_us % */ | ||
| 864 | if (perf_guest) { | ||
| 865 | ret += 13; /* count_guest_sys % */ | ||
| 866 | ret += 12; /* count_guest_us % */ | ||
| 867 | } | ||
| 868 | } | ||
| 869 | |||
| 870 | if (symbol_conf.show_nr_samples) | ||
| 871 | ret += 11; | ||
| 872 | |||
| 873 | list_for_each_entry(se, &hist_entry__sort_list, list) | ||
| 874 | if (!se->elide) | ||
| 875 | ret += 2 + hists__col_len(self, se->se_width_idx); | ||
| 876 | |||
| 877 | return ret; | ||
| 878 | } | ||
| 879 | |||
| 853 | static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h, | 880 | static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h, |
| 854 | enum hist_filter filter) | 881 | enum hist_filter filter) |
| 855 | { | 882 | { |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 92962b2f579b..65a48db46a29 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -141,4 +141,7 @@ int hist_entry__tui_annotate(struct hist_entry *self); | |||
| 141 | 141 | ||
| 142 | int hists__tui_browse_tree(struct rb_root *self, const char *help); | 142 | int hists__tui_browse_tree(struct rb_root *self, const char *help); |
| 143 | #endif | 143 | #endif |
| 144 | |||
| 145 | unsigned int hists__sort_list_width(struct hists *self); | ||
| 146 | |||
| 144 | #endif /* __PERF_HIST_H */ | 147 | #endif /* __PERF_HIST_H */ |
