perf tools: Add missing 'node' alias to the hw_cache[] array
[deliverable/linux.git] / tools / perf / util / session.h
CommitLineData
94c744b6
ACM
1#ifndef __PERF_SESSION_H
2#define __PERF_SESSION_H
3
1c02c4d2 4#include "hist.h"
301a0b02 5#include "event.h"
94c744b6 6#include "header.h"
9de89fe7 7#include "symbol.h"
4aa65636 8#include "thread.h"
b3165f41 9#include <linux/rbtree.h>
f823e441 10#include "../../../include/linux/perf_event.h"
b3165f41 11
c61e52ee 12struct sample_queue;
a328626b 13struct ip_callchain;
b3165f41 14struct thread;
94c744b6 15
c61e52ee
FW
16struct ordered_samples {
17 u64 last_flush;
d6b17beb
FW
18 u64 next_flush;
19 u64 max_timestamp;
a1225dec 20 struct list_head samples;
020bb75a 21 struct list_head sample_cache;
5c891f38
TG
22 struct list_head to_free;
23 struct sample_queue *sample_buffer;
a1225dec 24 struct sample_queue *last_sample;
5c891f38 25 int sample_buffer_idx;
c61e52ee
FW
26};
27
94c744b6
ACM
28struct perf_session {
29 struct perf_header header;
30 unsigned long size;
ec913369 31 unsigned long mmap_window;
b3165f41 32 struct rb_root threads;
720a3aeb 33 struct list_head dead_threads;
b3165f41 34 struct thread *last_match;
1f626bc3 35 struct machine host_machine;
23346f21 36 struct rb_root machines;
e248de33 37 struct perf_evlist *evlist;
1c02c4d2 38 /*
e248de33
ACM
39 * FIXME: Need to split this up further, we need global
40 * stats + per event stats. 'perf diff' also needs
41 * to properly support multiple events in a single
42 * perf.data file.
1c02c4d2
ACM
43 */
44 struct hists hists;
c019879b 45 u64 sample_type;
a2854124 46 int sample_size;
94c744b6 47 int fd;
8dc58101 48 bool fd_pipe;
454c407e 49 bool repipe;
9c90a61c
ACM
50 bool sample_id_all;
51 u16 id_hdr_size;
ec913369
ACM
52 int cwdlen;
53 char *cwd;
c61e52ee 54 struct ordered_samples ordered_samples;
1b3a0e95
FW
55 struct callchain_cursor callchain_cursor;
56 char filename[0];
94c744b6
ACM
57};
58
9e69c210 59struct perf_evsel;
d6b17beb
FW
60struct perf_event_ops;
61
9e69c210
ACM
62typedef int (*event_sample)(union perf_event *event, struct perf_sample *sample,
63 struct perf_evsel *evsel, struct perf_session *session);
8115d60c 64typedef int (*event_op)(union perf_event *self, struct perf_sample *sample,
640c03ce 65 struct perf_session *session);
8115d60c
ACM
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,
d6b17beb 69 struct perf_event_ops *ops);
301a0b02
ACM
70
71struct perf_event_ops {
9e69c210
ACM
72 event_sample sample;
73 event_op mmap,
d6b17beb
FW
74 comm,
75 fork,
76 exit,
77 lost,
78 read,
79 throttle,
640c03ce
ACM
80 unthrottle;
81 event_synth_op attr,
d6b17beb
FW
82 event_type,
83 tracing_data,
84 build_id;
85 event_op2 finished_round;
86 bool ordered_samples;
21ef97f0 87 bool ordering_requires_timestamps;
301a0b02
ACM
88};
89
21ef97f0
IM
90struct perf_session *perf_session__new(const char *filename, int mode,
91 bool force, bool repipe,
92 struct perf_event_ops *ops);
94c744b6
ACM
93void perf_session__delete(struct perf_session *self);
94
ba21594c
ACM
95void perf_event_header__bswap(struct perf_event_header *self);
96
6122e4e4
ACM
97int __perf_session__process_events(struct perf_session *self,
98 u64 data_offset, u64 data_size, u64 size,
99 struct perf_event_ops *ops);
301a0b02 100int perf_session__process_events(struct perf_session *self,
ec913369 101 struct perf_event_ops *event_ops);
301a0b02 102
1b3a0e95
FW
103int perf_session__resolve_callchain(struct perf_session *self,
104 struct thread *thread,
105 struct ip_callchain *chain,
106 struct symbol **parent);
a328626b 107
d549c769 108bool perf_session__has_traces(struct perf_session *self, const char *msg);
27295592 109
a1645ce1 110int perf_session__set_kallsyms_ref_reloc_sym(struct map **maps,
56b03f3c
ACM
111 const char *symbol_name,
112 u64 addr);
56b03f3c 113
ba21594c
ACM
114void mem_bswap_64(void *src, int byte_size);
115
a1645ce1 116int perf_session__create_kernel_maps(struct perf_session *self);
f9224c5c 117
8dc58101 118void perf_session__update_sample_type(struct perf_session *self);
720a3aeb 119void perf_session__remove_thread(struct perf_session *self, struct thread *th);
8dc58101 120
23346f21
ACM
121static inline
122struct machine *perf_session__find_host_machine(struct perf_session *self)
123{
1f626bc3 124 return &self->host_machine;
23346f21
ACM
125}
126
127static inline
128struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid)
129{
1f626bc3
ACM
130 if (pid == HOST_KERNEL_ID)
131 return &self->host_machine;
23346f21
ACM
132 return machines__find(&self->machines, pid);
133}
134
135static inline
136struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid)
137{
1f626bc3
ACM
138 if (pid == HOST_KERNEL_ID)
139 return &self->host_machine;
23346f21
ACM
140 return machines__findnew(&self->machines, pid);
141}
142
143static inline
144void perf_session__process_machines(struct perf_session *self,
145 machine__process_t process)
146{
1f626bc3 147 process(&self->host_machine, self);
23346f21
ACM
148 return machines__process(&self->machines, process, self);
149}
cbf69680 150
1f626bc3 151size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);
cbf69680 152
f869097e
ACM
153size_t perf_session__fprintf_dsos_buildid(struct perf_session *self,
154 FILE *fp, bool with_hits);
c8446b9b 155
e248de33 156size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
d0dd74e8
ACM
157
158static inline int perf_session__parse_sample(struct perf_session *session,
8115d60c 159 const union perf_event *event,
8d50e5b4 160 struct perf_sample *sample)
d0dd74e8 161{
8115d60c 162 return perf_event__parse_sample(event, session->sample_type,
a2854124 163 session->sample_size,
8115d60c 164 session->sample_id_all, sample);
d0dd74e8
ACM
165}
166
9cbdb702
DA
167struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
168 unsigned int type);
169
787bef17 170void perf_session__print_ip(union perf_event *event,
c0230b2b 171 struct perf_sample *sample,
787bef17 172 struct perf_session *session,
610723f2 173 int print_sym, int print_dso);
c0230b2b 174
5d67be97
AB
175int perf_session__cpu_bitmap(struct perf_session *session,
176 const char *cpu_list, unsigned long *cpu_bitmap);
177
94c744b6 178#endif /* __PERF_SESSION_H */
This page took 0.089527 seconds and 5 git commands to generate.