perf: Convert perf header attrs into attr events
[linux-2.6/cjktty.git] / tools / perf / util / session.h
blob45a13741351ddfa5b5cbe4d7bf0924a52b8f0ce8
1 #ifndef __PERF_SESSION_H
2 #define __PERF_SESSION_H
4 #include "event.h"
5 #include "header.h"
6 #include "symbol.h"
7 #include "thread.h"
8 #include <linux/rbtree.h>
9 #include "../../../include/linux/perf_event.h"
11 struct ip_callchain;
12 struct thread;
14 struct perf_session {
15 struct perf_header header;
16 unsigned long size;
17 unsigned long mmap_window;
18 struct map_groups kmaps;
19 struct rb_root threads;
20 struct thread *last_match;
21 struct map *vmlinux_maps[MAP__NR_TYPES];
22 struct events_stats events_stats;
23 struct rb_root stats_by_id;
24 unsigned long event_total[PERF_RECORD_MAX];
25 unsigned long unknown_events;
26 struct rb_root hists;
27 u64 sample_type;
28 struct ref_reloc_sym ref_reloc_sym;
29 int fd;
30 bool fd_pipe;
31 int cwdlen;
32 char *cwd;
33 char filename[0];
36 typedef int (*event_op)(event_t *self, struct perf_session *session);
38 struct perf_event_ops {
39 event_op sample,
40 mmap,
41 comm,
42 fork,
43 exit,
44 lost,
45 read,
46 throttle,
47 unthrottle,
48 attr;
51 struct perf_session *perf_session__new(const char *filename, int mode, bool force);
52 void perf_session__delete(struct perf_session *self);
54 void perf_event_header__bswap(struct perf_event_header *self);
56 int __perf_session__process_events(struct perf_session *self,
57 u64 data_offset, u64 data_size, u64 size,
58 struct perf_event_ops *ops);
59 int perf_session__process_events(struct perf_session *self,
60 struct perf_event_ops *event_ops);
62 struct map_symbol *perf_session__resolve_callchain(struct perf_session *self,
63 struct thread *thread,
64 struct ip_callchain *chain,
65 struct symbol **parent);
67 bool perf_session__has_traces(struct perf_session *self, const char *msg);
69 int perf_header__read_build_ids(struct perf_header *self, int input,
70 u64 offset, u64 file_size);
72 int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
73 const char *symbol_name,
74 u64 addr);
76 void mem_bswap_64(void *src, int byte_size);
78 static inline int __perf_session__create_kernel_maps(struct perf_session *self,
79 struct dso *kernel)
81 return __map_groups__create_kernel_maps(&self->kmaps,
82 self->vmlinux_maps, kernel);
85 static inline int perf_session__create_kernel_maps(struct perf_session *self)
87 return map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps);
90 static inline struct map *
91 perf_session__new_module_map(struct perf_session *self,
92 u64 start, const char *filename)
94 return map_groups__new_module(&self->kmaps, start, filename);
97 int do_read(int fd, void *buf, size_t size);
98 void perf_session__update_sample_type(struct perf_session *self);
100 #ifdef NO_NEWT_SUPPORT
101 static inline int perf_session__browse_hists(struct rb_root *hists __used,
102 u64 nr_hists __used,
103 u64 session_total __used,
104 const char *helpline __used,
105 const char *input_name __used)
107 return 0;
109 #else
110 int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
111 u64 session_total, const char *helpline,
112 const char *input_name);
113 #endif
114 #endif /* __PERF_SESSION_H */