perf: Fix initialization bug in parse_single_tracepoint_event()
[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;
b3165f41
ACM
18 struct rb_root threads;
19 struct thread *last_match;
a1645ce1 20 struct rb_root kerninfo_root;
f823e441 21 struct events_stats events_stats;
cb8f0939 22 struct rb_root stats_by_id;
f823e441 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;
94c744b6 27 int fd;
8dc58101 28 bool fd_pipe;
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,
2c46dbb5 45 unthrottle,
cd19a035 46 attr,
9215545e 47 event_type,
c7929e47
TZ
48 tracing_data,
49 build_id;
301a0b02
ACM
50};
51
75be6cf4 52struct perf_session *perf_session__new(const char *filename, int mode, bool force);
94c744b6
ACM
53void perf_session__delete(struct perf_session *self);
54
ba21594c
ACM
55void perf_event_header__bswap(struct perf_event_header *self);
56
6122e4e4
ACM
57int __perf_session__process_events(struct perf_session *self,
58 u64 data_offset, u64 data_size, u64 size,
59 struct perf_event_ops *ops);
301a0b02 60int perf_session__process_events(struct perf_session *self,
ec913369 61 struct perf_event_ops *event_ops);
301a0b02 62
b3c9ac08
ACM
63struct map_symbol *perf_session__resolve_callchain(struct perf_session *self,
64 struct thread *thread,
65 struct ip_callchain *chain,
66 struct symbol **parent);
a328626b 67
d549c769 68bool perf_session__has_traces(struct perf_session *self, const char *msg);
27295592 69
a1645ce1 70int perf_session__set_kallsyms_ref_reloc_sym(struct map **maps,
56b03f3c
ACM
71 const char *symbol_name,
72 u64 addr);
56b03f3c 73
ba21594c
ACM
74void mem_bswap_64(void *src, int byte_size);
75
a1645ce1 76int perf_session__create_kernel_maps(struct perf_session *self);
f9224c5c 77
8dc58101
TZ
78int do_read(int fd, void *buf, size_t size);
79void perf_session__update_sample_type(struct perf_session *self);
80
f9224c5c 81#ifdef NO_NEWT_SUPPORT
5f4d3f88
ACM
82static inline int perf_session__browse_hists(struct rb_root *hists __used,
83 u64 nr_hists __used,
f9224c5c 84 u64 session_total __used,
533c46c3
ACM
85 const char *helpline __used,
86 const char *input_name __used)
5f4d3f88
ACM
87{
88 return 0;
89}
f9224c5c 90#else
5f4d3f88 91int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
533c46c3
ACM
92 u64 session_total, const char *helpline,
93 const char *input_name);
f9224c5c 94#endif
94c744b6 95#endif /* __PERF_SESSION_H */