diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-14 10:10:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-14 10:57:18 -0500 |
commit | 4e4f06e4c8f17ea96f7dd76251cab99511026401 (patch) | |
tree | 18b7f83b664939be0a9bde8e43daf9db8ca7fccc /tools/perf/builtin-annotate.c | |
parent | b9bf089212d95746ce66482bcdbc7e77a0651088 (diff) |
perf session: Move the hist_entries rb tree to perf_session
As we'll need to sort multiple times for multiple perf sessions,
so that we can then do a diff.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260803439-16783-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index f25e89e9c9b0..1f1341f1dd84 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -121,10 +121,12 @@ static void hist_hit(struct hist_entry *he, u64 ip) | |||
121 | h->ip[offset]); | 121 | h->ip[offset]); |
122 | } | 122 | } |
123 | 123 | ||
124 | static int hist_entry__add(struct addr_location *al, u64 count) | 124 | static int perf_session__add_hist_entry(struct perf_session *self, |
125 | struct addr_location *al, u64 count) | ||
125 | { | 126 | { |
126 | bool hit; | 127 | bool hit; |
127 | struct hist_entry *he = __hist_entry__add(al, NULL, count, &hit); | 128 | struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL, |
129 | count, &hit); | ||
128 | if (he == NULL) | 130 | if (he == NULL) |
129 | return -ENOMEM; | 131 | return -ENOMEM; |
130 | hist_hit(he, al->addr); | 132 | hist_hit(he, al->addr); |
@@ -144,7 +146,7 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
144 | return -1; | 146 | return -1; |
145 | } | 147 | } |
146 | 148 | ||
147 | if (hist_entry__add(&al, 1)) { | 149 | if (perf_session__add_hist_entry(session, &al, 1)) { |
148 | fprintf(stderr, "problem incrementing symbol count, " | 150 | fprintf(stderr, "problem incrementing symbol count, " |
149 | "skipping event\n"); | 151 | "skipping event\n"); |
150 | return -1; | 152 | return -1; |
@@ -428,11 +430,11 @@ static void annotate_sym(struct hist_entry *he) | |||
428 | free_source_line(he, len); | 430 | free_source_line(he, len); |
429 | } | 431 | } |
430 | 432 | ||
431 | static void find_annotations(void) | 433 | static void perf_session__find_annotations(struct perf_session *self) |
432 | { | 434 | { |
433 | struct rb_node *nd; | 435 | struct rb_node *nd; |
434 | 436 | ||
435 | for (nd = rb_first(&hist); nd; nd = rb_next(nd)) { | 437 | for (nd = rb_first(&self->hists); nd; nd = rb_next(nd)) { |
436 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); | 438 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); |
437 | struct sym_priv *priv; | 439 | struct sym_priv *priv; |
438 | 440 | ||
@@ -484,10 +486,9 @@ static int __cmd_annotate(void) | |||
484 | if (verbose > 2) | 486 | if (verbose > 2) |
485 | dsos__fprintf(stdout); | 487 | dsos__fprintf(stdout); |
486 | 488 | ||
487 | collapse__resort(); | 489 | perf_session__collapse_resort(session); |
488 | output__resort(event__total[0]); | 490 | perf_session__output_resort(session, event__total[0]); |
489 | 491 | perf_session__find_annotations(session); | |
490 | find_annotations(); | ||
491 | out_delete: | 492 | out_delete: |
492 | perf_session__delete(session); | 493 | perf_session__delete(session); |
493 | 494 | ||