perf build-id: Move the routine to find DSOs with hits to the lib
[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
ACM
22 struct events_stats events_stats;
23 unsigned long event_total[PERF_RECORD_MAX];
31d337c4 24 unsigned long unknown_events;
4e4f06e4 25 struct rb_root hists;
c019879b 26 u64 sample_type;
9de89fe7 27 struct ref_reloc_sym ref_reloc_sym;
94c744b6 28 int fd;
ec913369
ACM
29 int cwdlen;
30 char *cwd;
94c744b6
ACM
31 char filename[0];
32};
33
301a0b02
ACM
34typedef int (*event_op)(event_t *self, struct perf_session *session);
35
36struct perf_event_ops {
55aa640f
ACM
37 event_op sample,
38 mmap,
39 comm,
40 fork,
41 exit,
42 lost,
43 read,
44 throttle,
45 unthrottle;
301a0b02
ACM
46};
47
75be6cf4 48struct perf_session *perf_session__new(const char *filename, int mode, bool force);
94c744b6
ACM
49void perf_session__delete(struct perf_session *self);
50
ba21594c
ACM
51void perf_event_header__bswap(struct perf_event_header *self);
52
301a0b02 53int perf_session__process_events(struct perf_session *self,
ec913369 54 struct perf_event_ops *event_ops);
301a0b02 55
a328626b
ACM
56struct symbol **perf_session__resolve_callchain(struct perf_session *self,
57 struct thread *thread,
58 struct ip_callchain *chain,
59 struct symbol **parent);
60
d549c769 61bool perf_session__has_traces(struct perf_session *self, const char *msg);
27295592 62
ba21594c
ACM
63int perf_header__read_build_ids(struct perf_header *self, int input,
64 u64 offset, u64 file_size);
301a0b02 65
56b03f3c
ACM
66int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
67 const char *symbol_name,
68 u64 addr);
56b03f3c 69
ba21594c
ACM
70void mem_bswap_64(void *src, int byte_size);
71
9de89fe7
ACM
72static inline int __perf_session__create_kernel_maps(struct perf_session *self,
73 struct dso *kernel)
74{
75 return __map_groups__create_kernel_maps(&self->kmaps,
76 self->vmlinux_maps, kernel);
77}
78
79static inline struct map *
80 perf_session__new_module_map(struct perf_session *self,
81 u64 start, const char *filename)
82{
83 return map_groups__new_module(&self->kmaps, start, filename);
84}
94c744b6 85#endif /* __PERF_SESSION_H */