aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /tools/perf/util/session.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'tools/perf/util/session.h')
-rw-r--r--tools/perf/util/session.h75
1 files changed, 52 insertions, 23 deletions
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 9fa0fc2a863f..66d4e1490879 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -17,8 +17,12 @@ struct ordered_samples {
17 u64 last_flush; 17 u64 last_flush;
18 u64 next_flush; 18 u64 next_flush;
19 u64 max_timestamp; 19 u64 max_timestamp;
20 struct list_head samples_head; 20 struct list_head samples;
21 struct sample_queue *last_inserted; 21 struct list_head sample_cache;
22 struct list_head to_free;
23 struct sample_queue *sample_buffer;
24 struct sample_queue *last_sample;
25 int sample_buffer_idx;
22}; 26};
23 27
24struct perf_session { 28struct perf_session {
@@ -30,49 +34,62 @@ struct perf_session {
30 struct thread *last_match; 34 struct thread *last_match;
31 struct machine host_machine; 35 struct machine host_machine;
32 struct rb_root machines; 36 struct rb_root machines;
33 struct rb_root hists_tree; 37 struct perf_evlist *evlist;
34 /* 38 /*
35 * FIXME: should point to the first entry in hists_tree and 39 * FIXME: Need to split this up further, we need global
36 * be a hists instance. Right now its only 'report' 40 * stats + per event stats. 'perf diff' also needs
37 * that is using ->hists_tree while all the rest use 41 * to properly support multiple events in a single
38 * ->hists. 42 * perf.data file.
39 */ 43 */
40 struct hists hists; 44 struct hists hists;
41 u64 sample_type; 45 u64 sample_type;
46 int sample_size;
42 int fd; 47 int fd;
43 bool fd_pipe; 48 bool fd_pipe;
44 bool repipe; 49 bool repipe;
50 bool sample_id_all;
51 u16 id_hdr_size;
45 int cwdlen; 52 int cwdlen;
46 char *cwd; 53 char *cwd;
47 struct ordered_samples ordered_samples; 54 struct ordered_samples ordered_samples;
48 char filename[0]; 55 struct callchain_cursor callchain_cursor;
56 char filename[0];
49}; 57};
50 58
59struct perf_evsel;
51struct perf_event_ops; 60struct perf_event_ops;
52 61
53typedef int (*event_op)(event_t *self, struct perf_session *session); 62typedef int (*event_sample)(union perf_event *event, struct perf_sample *sample,
54typedef int (*event_op2)(event_t *self, struct perf_session *session, 63 struct perf_evsel *evsel, struct perf_session *session);
64typedef int (*event_op)(union perf_event *self, struct perf_sample *sample,
65 struct perf_session *session);
66typedef int (*event_synth_op)(union perf_event *self,
67 struct perf_session *session);
68typedef int (*event_op2)(union perf_event *self, struct perf_session *session,
55 struct perf_event_ops *ops); 69 struct perf_event_ops *ops);
56 70
57struct perf_event_ops { 71struct perf_event_ops {
58 event_op sample, 72 event_sample sample;
59 mmap, 73 event_op mmap,
60 comm, 74 comm,
61 fork, 75 fork,
62 exit, 76 exit,
63 lost, 77 lost,
64 read, 78 read,
65 throttle, 79 throttle,
66 unthrottle, 80 unthrottle;
67 attr, 81 event_synth_op attr,
68 event_type, 82 event_type,
69 tracing_data, 83 tracing_data,
70 build_id; 84 build_id;
71 event_op2 finished_round; 85 event_op2 finished_round;
72 bool ordered_samples; 86 bool ordered_samples;
87 bool ordering_requires_timestamps;
73}; 88};
74 89
75struct perf_session *perf_session__new(const char *filename, int mode, bool force, bool repipe); 90struct perf_session *perf_session__new(const char *filename, int mode,
91 bool force, bool repipe,
92 struct perf_event_ops *ops);
76void perf_session__delete(struct perf_session *self); 93void perf_session__delete(struct perf_session *self);
77 94
78void perf_event_header__bswap(struct perf_event_header *self); 95void perf_event_header__bswap(struct perf_event_header *self);
@@ -83,10 +100,10 @@ int __perf_session__process_events(struct perf_session *self,
83int perf_session__process_events(struct perf_session *self, 100int perf_session__process_events(struct perf_session *self,
84 struct perf_event_ops *event_ops); 101 struct perf_event_ops *event_ops);
85 102
86struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, 103int perf_session__resolve_callchain(struct perf_session *self,
87 struct thread *thread, 104 struct thread *thread,
88 struct ip_callchain *chain, 105 struct ip_callchain *chain,
89 struct symbol **parent); 106 struct symbol **parent);
90 107
91bool perf_session__has_traces(struct perf_session *self, const char *msg); 108bool perf_session__has_traces(struct perf_session *self, const char *msg);
92 109
@@ -98,7 +115,6 @@ void mem_bswap_64(void *src, int byte_size);
98 115
99int perf_session__create_kernel_maps(struct perf_session *self); 116int perf_session__create_kernel_maps(struct perf_session *self);
100 117
101int do_read(int fd, void *buf, size_t size);
102void perf_session__update_sample_type(struct perf_session *self); 118void perf_session__update_sample_type(struct perf_session *self);
103void perf_session__remove_thread(struct perf_session *self, struct thread *th); 119void perf_session__remove_thread(struct perf_session *self, struct thread *th);
104 120
@@ -137,9 +153,22 @@ size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);
137size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, 153size_t perf_session__fprintf_dsos_buildid(struct perf_session *self,
138 FILE *fp, bool with_hits); 154 FILE *fp, bool with_hits);
139 155
140static inline 156size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
141size_t perf_session__fprintf_nr_events(struct perf_session *self, FILE *fp) 157
158static inline int perf_session__parse_sample(struct perf_session *session,
159 const union perf_event *event,
160 struct perf_sample *sample)
142{ 161{
143 return hists__fprintf_nr_events(&self->hists, fp); 162 return perf_event__parse_sample(event, session->sample_type,
163 session->sample_size,
164 session->sample_id_all, sample);
144} 165}
166
167struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
168 unsigned int type);
169
170void perf_session__print_symbols(union perf_event *event,
171 struct perf_sample *sample,
172 struct perf_session *session);
173
145#endif /* __PERF_SESSION_H */ 174#endif /* __PERF_SESSION_H */