include: replace linux/module.h with "struct module" wherever possible
[linux-2.6/next.git] / tools / perf / util / header.h
blob1886256768a176e72ae9e3f3e476dde7b26ea728
1 #ifndef __PERF_HEADER_H
2 #define __PERF_HEADER_H
4 #include "../../../include/linux/perf_event.h"
5 #include <sys/types.h>
6 #include <stdbool.h>
7 #include "types.h"
8 #include "event.h"
10 #include <linux/bitmap.h>
12 enum {
13 HEADER_TRACE_INFO = 1,
14 HEADER_BUILD_ID,
15 HEADER_LAST_FEATURE,
18 #define HEADER_FEAT_BITS 256
20 struct perf_file_section {
21 u64 offset;
22 u64 size;
25 struct perf_file_header {
26 u64 magic;
27 u64 size;
28 u64 attr_size;
29 struct perf_file_section attrs;
30 struct perf_file_section data;
31 struct perf_file_section event_types;
32 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
35 struct perf_pipe_file_header {
36 u64 magic;
37 u64 size;
40 struct perf_header;
42 int perf_file_header__read(struct perf_file_header *header,
43 struct perf_header *ph, int fd);
45 struct perf_header {
46 int frozen;
47 bool needs_swap;
48 s64 attr_offset;
49 u64 data_offset;
50 u64 data_size;
51 u64 event_offset;
52 u64 event_size;
53 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
56 struct perf_evlist;
58 int perf_session__read_header(struct perf_session *session, int fd);
59 int perf_session__write_header(struct perf_session *session,
60 struct perf_evlist *evlist,
61 int fd, bool at_exit);
62 int perf_header__write_pipe(int fd);
64 int perf_header__push_event(u64 id, const char *name);
65 char *perf_header__find_event(u64 id);
67 void perf_header__set_feat(struct perf_header *header, int feat);
68 void perf_header__clear_feat(struct perf_header *header, int feat);
69 bool perf_header__has_feat(const struct perf_header *header, int feat);
71 int perf_header__process_sections(struct perf_header *header, int fd,
72 int (*process)(struct perf_file_section *section,
73 struct perf_header *ph,
74 int feat, int fd));
76 int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
77 const char *name, bool is_kallsyms);
78 int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
80 int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
81 perf_event__handler_t process,
82 struct perf_session *session);
83 int perf_session__synthesize_attrs(struct perf_session *session,
84 perf_event__handler_t process);
85 int perf_event__process_attr(union perf_event *event, struct perf_session *session);
87 int perf_event__synthesize_event_type(u64 event_id, char *name,
88 perf_event__handler_t process,
89 struct perf_session *session);
90 int perf_event__synthesize_event_types(perf_event__handler_t process,
91 struct perf_session *session);
92 int perf_event__process_event_type(union perf_event *event,
93 struct perf_session *session);
95 int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
96 perf_event__handler_t process,
97 struct perf_session *session);
98 int perf_event__process_tracing_data(union perf_event *event,
99 struct perf_session *session);
101 int perf_event__synthesize_build_id(struct dso *pos, u16 misc,
102 perf_event__handler_t process,
103 struct machine *machine,
104 struct perf_session *session);
105 int perf_event__process_build_id(union perf_event *event,
106 struct perf_session *session);
107 #endif /* __PERF_HEADER_H */