diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-14 12:06:01 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-15 02:50:28 -0500 |
commit | f823e441ab4dfaeaf17832fa1931e0dc0fde304d (patch) | |
tree | 6bfaf4a3c4c5e2d5f65abece7996b005302e6af6 /tools/perf | |
parent | c019879bcc5692ec9267c1cedad91f1794d0b693 (diff) |
perf session: Event statistics also are per session
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: <1260810361-22828-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 2 | ||||
-rw-r--r-- | tools/perf/util/event.c | 6 | ||||
-rw-r--r-- | tools/perf/util/event.h | 5 | ||||
-rw-r--r-- | tools/perf/util/session.h | 3 |
6 files changed, 10 insertions, 15 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 1f1341f1dd84..fa833f50763e 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -487,7 +487,7 @@ static int __cmd_annotate(void) | |||
487 | dsos__fprintf(stdout); | 487 | dsos__fprintf(stdout); |
488 | 488 | ||
489 | perf_session__collapse_resort(session); | 489 | perf_session__collapse_resort(session); |
490 | perf_session__output_resort(session, event__total[0]); | 490 | perf_session__output_resort(session, session->event_total[0]); |
491 | perf_session__find_annotations(session); | 491 | perf_session__find_annotations(session); |
492 | out_delete: | 492 | out_delete: |
493 | perf_session__delete(session); | 493 | perf_session__delete(session); |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 142c475f9918..d12ea4ab0d21 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -619,8 +619,7 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
619 | return -1; | 619 | return -1; |
620 | } | 620 | } |
621 | 621 | ||
622 | event__stats.total += data.period; | 622 | session->events_stats.total += data.period; |
623 | |||
624 | return 0; | 623 | return 0; |
625 | } | 624 | } |
626 | 625 | ||
@@ -731,8 +730,8 @@ static int __cmd_report(void) | |||
731 | dsos__fprintf(stdout); | 730 | dsos__fprintf(stdout); |
732 | 731 | ||
733 | perf_session__collapse_resort(session); | 732 | perf_session__collapse_resort(session); |
734 | perf_session__output_resort(session, event__stats.total); | 733 | perf_session__output_resort(session, session->events_stats.total); |
735 | perf_session__fprintf_hist_entries(session, event__stats.total, stdout); | 734 | perf_session__fprintf_hist_entries(session, session->events_stats.total, stdout); |
736 | 735 | ||
737 | if (show_threads) | 736 | if (show_threads) |
738 | perf_read_values_destroy(&show_threads_values); | 737 | perf_read_values_destroy(&show_threads_values); |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 9ee976dc395b..07da66511bd5 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -96,8 +96,8 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
96 | data.raw_size, | 96 | data.raw_size, |
97 | data.time, thread->comm); | 97 | data.time, thread->comm); |
98 | } | 98 | } |
99 | event__stats.total += data.period; | ||
100 | 99 | ||
100 | session->events_stats.total += data.period; | ||
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
103 | 103 | ||
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 222efb1fc3bd..375fb6dca1cf 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -187,8 +187,6 @@ void event__synthesize_threads(int (*process)(event_t *event, | |||
187 | closedir(proc); | 187 | closedir(proc); |
188 | } | 188 | } |
189 | 189 | ||
190 | struct events_stats event__stats; | ||
191 | |||
192 | int event__process_comm(event_t *self, struct perf_session *session) | 190 | int event__process_comm(event_t *self, struct perf_session *session) |
193 | { | 191 | { |
194 | struct thread *thread = perf_session__findnew(session, self->comm.pid); | 192 | struct thread *thread = perf_session__findnew(session, self->comm.pid); |
@@ -203,10 +201,10 @@ int event__process_comm(event_t *self, struct perf_session *session) | |||
203 | return 0; | 201 | return 0; |
204 | } | 202 | } |
205 | 203 | ||
206 | int event__process_lost(event_t *self, struct perf_session *session __used) | 204 | int event__process_lost(event_t *self, struct perf_session *session) |
207 | { | 205 | { |
208 | dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); | 206 | dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); |
209 | event__stats.lost += self->lost.lost; | 207 | session->events_stats.lost += self->lost.lost; |
210 | return 0; | 208 | return 0; |
211 | } | 209 | } |
212 | 210 | ||
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 035ecf3c25cc..a92e0b039a6a 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -168,11 +168,6 @@ void event__synthesize_threads(int (*process)(event_t *event, | |||
168 | struct perf_session *session), | 168 | struct perf_session *session), |
169 | struct perf_session *session); | 169 | struct perf_session *session); |
170 | 170 | ||
171 | extern char *event__cwd; | ||
172 | extern int event__cwdlen; | ||
173 | extern struct events_stats event__stats; | ||
174 | extern unsigned long event__total[PERF_RECORD_MAX]; | ||
175 | |||
176 | int event__process_comm(event_t *self, struct perf_session *session); | 171 | int event__process_comm(event_t *self, struct perf_session *session); |
177 | int event__process_lost(event_t *self, struct perf_session *session); | 172 | int event__process_lost(event_t *self, struct perf_session *session); |
178 | int event__process_mmap(event_t *self, struct perf_session *session); | 173 | int event__process_mmap(event_t *self, struct perf_session *session); |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 4e8a21c5304c..bdfc4b8eee7a 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "header.h" | 5 | #include "header.h" |
6 | #include "thread.h" | 6 | #include "thread.h" |
7 | #include <linux/rbtree.h> | 7 | #include <linux/rbtree.h> |
8 | #include "../../../include/linux/perf_event.h" | ||
8 | 9 | ||
9 | struct ip_callchain; | 10 | struct ip_callchain; |
10 | struct thread; | 11 | struct thread; |
@@ -18,6 +19,8 @@ struct perf_session { | |||
18 | struct map_groups kmaps; | 19 | struct map_groups kmaps; |
19 | struct rb_root threads; | 20 | struct rb_root threads; |
20 | struct thread *last_match; | 21 | struct thread *last_match; |
22 | struct events_stats events_stats; | ||
23 | unsigned long event_total[PERF_RECORD_MAX]; | ||
21 | struct rb_root hists; | 24 | struct rb_root hists; |
22 | u64 sample_type; | 25 | u64 sample_type; |
23 | int fd; | 26 | int fd; |