aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-07-26 16:13:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-07-27 10:24:31 -0400
commit0f0cbf7aa3d3460a3eb201a772326739a0c0210a (patch)
tree9e2f4186acfd62a1a813abe576ffe6a35df9120d /tools/perf/util/sort.h
parent8d8c369f3d697e31e04133ca18b516952549ee33 (diff)
perf ui: New hists tree widget
The stock newt checkbox tree widget we were using was not really suitable for hist entry + callchain browsing. The problems with it were manifold: - We needed to traverse the whole hist_entry rb_tree to add each entry + callchains beforehand. - No control over the colors used for each row So a new tree widget, based mostly on slang, was written. It extends the ui_browser class already used for annotate to allow the user to fold/unfold branches in the callchains tree, using extra fields in the symbol_map class that is embedded in hist_entry and callchain_node instances to store the folding state and when changing this state calculates the number of rows that are produced when showing a particular hist_entry instance. This greatly speeds up browsing as we don't have to upfront touch all the entries and only calculate callchain related operations when some callchain branch is actually unfolded. The memory footprint is also reduced as the data structure is not duplicated, just some extra fields for controling callchain state and to simplify the process of seeking thru entries (nr_rows, row_offset) were added. 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>
Diffstat (limited to 'tools/perf/util/sort.h')
-rw-r--r--tools/perf/util/sort.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 03a1722e6d02..46e531d09e8b 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -38,6 +38,12 @@ extern struct sort_entry sort_sym;
38extern struct sort_entry sort_parent; 38extern struct sort_entry sort_parent;
39extern enum sort_type sort__first_dimension; 39extern enum sort_type sort__first_dimension;
40 40
41/**
42 * struct hist_entry - histogram entry
43 *
44 * @row_offset - offset from the first callchain expanded to appear on screen
45 * @nr_rows - rows expanded in callchain, recalculated on folding/unfolding
46 */
41struct hist_entry { 47struct hist_entry {
42 struct rb_node rb_node; 48 struct rb_node rb_node;
43 u64 period; 49 u64 period;
@@ -50,6 +56,12 @@ struct hist_entry {
50 u64 ip; 56 u64 ip;
51 s32 cpu; 57 s32 cpu;
52 u32 nr_events; 58 u32 nr_events;
59
60 /* XXX These two should move to some tree widget lib */
61 u16 row_offset;
62 u16 nr_rows;
63
64 bool init_have_children;
53 char level; 65 char level;
54 u8 filtered; 66 u8 filtered;
55 struct symbol *parent; 67 struct symbol *parent;