perf tools: Introduce struct map_symbol
[linux-2.6-block.git] / tools / perf / util / session.h
CommitLineData
94c744b6
ACM
1#ifndef __PERF_SESSION_H
2#define __PERF_SESSION_H
3
301a0b02 4#include "event.h"
94c744b6 5#include "header.h"
9de89fe7 6#include "symbol.h"
4aa65636 7#include "thread.h"
b3165f41 8#include <linux/rbtree.h>
f823e441 9#include "../../../include/linux/perf_event.h"
b3165f41 10
a328626b 11struct ip_callchain;
b3165f41 12struct thread;
94c744b6
ACM
13
14struct perf_session {
15 struct perf_header header;
16 unsigned long size;
ec913369 17 unsigned long mmap_window;
4aa65636 18 struct map_groups kmaps;
b3165f41
ACM
19 struct rb_root threads;
20 struct thread *last_match;
de176489 21 struct map *vmlinux_maps[MAP__NR_TYPES];
f823e441 22 struct events_stats events_stats;
cb8f0939 23 struct rb_root stats_by_id;
f823e441 24 unsigned long event_total[PERF_RECORD_MAX];
31d337c4 25 unsigned long unknown_events;
4e4f06e4 26 struct rb_root hists;
c019879b 27 u64 sample_type;
9de89fe7 28 struct ref_reloc_sym ref_reloc_sym;
94c744b6 29 int fd;
ec913369
ACM
30 int cwdlen;
31 char *cwd;
94c744b6
ACM
32 char filename[0];
33};
34
301a0b02
ACM
35typedef int (*event_op)(event_t *self, struct perf_session *session);
36
37struct perf_event_ops {
55aa640f
ACM
38 event_op sample,
39 mmap,
40 comm,
41 fork,
42 exit,
43 lost,
44 read,
45 throttle,
46 unthrottle;
301a0b02
ACM
47};
48
75be6cf4 49struct perf_session *perf_session__new(const char *filename, int mode, bool force);
94c744b6
ACM
50void perf_session__delete(struct perf_session *self);
51
ba21594c
ACM
52void perf_event_header__bswap(struct perf_event_header *self);
53
6122e4e4
ACM
54int __perf_session__process_events(struct perf_session *self,
55 u64 data_offset, u64 data_size, u64 size,
56 struct perf_event_ops *ops);
301a0b02 57int perf_session__process_events(struct perf_session *self,
ec913369 58 struct perf_event_ops *event_ops);
301a0b02 59
a328626b
ACM
60struct symbol **perf_session__resolve_callchain(struct perf_session *self,
61 struct thread *thread,
62 struct ip_callchain *chain,
63 struct symbol **parent);
64
d549c769 65bool perf_session__has_traces(struct perf_session *self, const char *msg);
27295592 66
ba21594c
ACM
67int perf_header__read_build_ids(struct perf_header *self, int input,
68 u64 offset, u64 file_size);
301a0b02 69
56b03f3c
ACM
70int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
71 const char *symbol_name,
72 u64 addr);
56b03f3c 73
ba21594c
ACM
74void mem_bswap_64(void *src, int byte_size);
75
9de89fe7
ACM
76static inline int __perf_session__create_kernel_maps(struct perf_session *self,
77 struct dso *kernel)
78{
79 return __map_groups__create_kernel_maps(&self->kmaps,
80 self->vmlinux_maps, kernel);
81}
82
83static inline struct map *
84 perf_session__new_module_map(struct perf_session *self,
85 u64 start, const char *filename)
86{
87 return map_groups__new_module(&self->kmaps, start, filename);
88}
f9224c5c
ACM
89
90#ifdef NO_NEWT_SUPPORT
91static inline void perf_session__browse_hists(struct rb_root *hists __used,
92 u64 session_total __used,
93 const char *helpline __used) {}
94#else
95void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
96 const char *helpline);
97#endif
94c744b6 98#endif /* __PERF_SESSION_H */