perf session: Event statistics also are per session
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 14 Dec 2009 17:06:01 +0000 (15:06 -0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 15 Dec 2009 07:50:28 +0000 (08:50 +0100)
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>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/builtin-trace.c
tools/perf/util/event.c
tools/perf/util/event.h
tools/perf/util/session.h

index 1f1341f1dd8481bb9060488a85db770916a873c2..fa833f50763eaf4ec53302a82bb66a70dd958fb0 100644 (file)
@@ -487,7 +487,7 @@ static int __cmd_annotate(void)
                dsos__fprintf(stdout);
 
        perf_session__collapse_resort(session);
-       perf_session__output_resort(session, event__total[0]);
+       perf_session__output_resort(session, session->event_total[0]);
        perf_session__find_annotations(session);
 out_delete:
        perf_session__delete(session);
index 142c475f9918899daf4ec30ab0e112438a586971..d12ea4ab0d21859a0a8c61eeffced573522d54ef 100644 (file)
@@ -619,8 +619,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                return -1;
        }
 
-       event__stats.total += data.period;
-
+       session->events_stats.total += data.period;
        return 0;
 }
 
@@ -731,8 +730,8 @@ static int __cmd_report(void)
                dsos__fprintf(stdout);
 
        perf_session__collapse_resort(session);
-       perf_session__output_resort(session, event__stats.total);
-       perf_session__fprintf_hist_entries(session, event__stats.total, stdout);
+       perf_session__output_resort(session, session->events_stats.total);
+       perf_session__fprintf_hist_entries(session, session->events_stats.total, stdout);
 
        if (show_threads)
                perf_read_values_destroy(&show_threads_values);
index 9ee976dc395b1c8f9ea2ac505e51e347dab9f516..07da66511bd59eda1c8b7211419c9850f6318e19 100644 (file)
@@ -96,8 +96,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                                             data.raw_size,
                                             data.time, thread->comm);
        }
-       event__stats.total += data.period;
 
+       session->events_stats.total += data.period;
        return 0;
 }
 
index 222efb1fc3bdbc3fa7acd0916caa7c64e7dbe480..375fb6dca1cf448544711ff30cda4f97fdb68fd6 100644 (file)
@@ -187,8 +187,6 @@ void event__synthesize_threads(int (*process)(event_t *event,
        closedir(proc);
 }
 
-struct events_stats event__stats;
-
 int event__process_comm(event_t *self, struct perf_session *session)
 {
        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)
        return 0;
 }
 
-int event__process_lost(event_t *self, struct perf_session *session __used)
+int event__process_lost(event_t *self, struct perf_session *session)
 {
        dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost);
-       event__stats.lost += self->lost.lost;
+       session->events_stats.lost += self->lost.lost;
        return 0;
 }
 
index 035ecf3c25cc2b9d0a5a52516a04e12df66adacf..a92e0b039a6a6cc72a808824a6d0ea37c5497357 100644 (file)
@@ -168,11 +168,6 @@ void event__synthesize_threads(int (*process)(event_t *event,
                                              struct perf_session *session),
                               struct perf_session *session);
 
-extern char *event__cwd;
-extern int  event__cwdlen;
-extern struct events_stats event__stats;
-extern unsigned long event__total[PERF_RECORD_MAX];
-
 int event__process_comm(event_t *self, struct perf_session *session);
 int event__process_lost(event_t *self, struct perf_session *session);
 int event__process_mmap(event_t *self, struct perf_session *session);
index 4e8a21c5304cac64cb1c96b90cdf3541d3309b0c..bdfc4b8eee7a4f7365b783b0da0abe9c3ae60c12 100644 (file)
@@ -5,6 +5,7 @@
 #include "header.h"
 #include "thread.h"
 #include <linux/rbtree.h>
+#include "../../../include/linux/perf_event.h"
 
 struct ip_callchain;
 struct thread;
@@ -18,6 +19,8 @@ struct perf_session {
        struct map_groups       kmaps;
        struct rb_root          threads;
        struct thread           *last_match;
+       struct events_stats     events_stats;
+       unsigned long           event_total[PERF_RECORD_MAX];
        struct rb_root          hists;
        u64                     sample_type;
        int                     fd;