header.h (2d8ad8719591fa803b0d589ed057fa46f49b7155) header.h (a91e5431d54f5359fccb5ec2512f252eb217707e)
1#ifndef __PERF_HEADER_H
2#define __PERF_HEADER_H
3
4#include "../../../include/linux/perf_event.h"
5#include <sys/types.h>
6#include <stdbool.h>
7#include "types.h"
8#include "event.h"
9
10#include <linux/bitmap.h>
11
1#ifndef __PERF_HEADER_H
2#define __PERF_HEADER_H
3
4#include "../../../include/linux/perf_event.h"
5#include <sys/types.h>
6#include <stdbool.h>
7#include "types.h"
8#include "event.h"
9
10#include <linux/bitmap.h>
11
12struct perf_header_attr {
13 struct perf_event_attr attr;
14 int ids, size;
15 u64 *id;
16 off_t id_offset;
17};
18
19enum {
20 HEADER_TRACE_INFO = 1,
21 HEADER_BUILD_ID,
22 HEADER_LAST_FEATURE,
23};
24
25#define HEADER_FEAT_BITS 256
26

--- 19 unchanged lines hidden (view full) ---

46
47struct perf_header;
48
49int perf_file_header__read(struct perf_file_header *self,
50 struct perf_header *ph, int fd);
51
52struct perf_header {
53 int frozen;
12enum {
13 HEADER_TRACE_INFO = 1,
14 HEADER_BUILD_ID,
15 HEADER_LAST_FEATURE,
16};
17
18#define HEADER_FEAT_BITS 256
19

--- 19 unchanged lines hidden (view full) ---

39
40struct perf_header;
41
42int perf_file_header__read(struct perf_file_header *self,
43 struct perf_header *ph, int fd);
44
45struct perf_header {
46 int frozen;
54 int attrs, size;
55 bool needs_swap;
47 bool needs_swap;
56 struct perf_header_attr **attr;
57 s64 attr_offset;
58 u64 data_offset;
59 u64 data_size;
60 u64 event_offset;
61 u64 event_size;
62 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
63};
64
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);
54};
55
65int perf_header__init(struct perf_header *self);
66void perf_header__exit(struct perf_header *self);
56struct perf_evlist;
67
57
68int perf_header__read(struct perf_session *session, int fd);
69int perf_header__write(struct perf_header *self, int fd, bool at_exit);
58int perf_session__read_header(struct perf_session *session, int fd);
59int perf_session__write_header(struct perf_session *session,
60 struct perf_evlist *evlist,
61 int fd, bool at_exit);
70int perf_header__write_pipe(int fd);
71
62int perf_header__write_pipe(int fd);
63
72int perf_header__add_attr(struct perf_header *self,
73 struct perf_header_attr *attr);
74
75int perf_header__push_event(u64 id, const char *name);
76char *perf_header__find_event(u64 id);
77
64int perf_header__push_event(u64 id, const char *name);
65char *perf_header__find_event(u64 id);
66
78struct perf_header_attr *perf_header_attr__new(struct perf_event_attr *attr);
79void perf_header_attr__delete(struct perf_header_attr *self);
80
81int perf_header_attr__add_id(struct perf_header_attr *self, u64 id);
82
83u64 perf_header__sample_type(struct perf_header *header);
84bool perf_header__sample_id_all(const struct perf_header *header);
85struct perf_event_attr *
86perf_header__find_attr(u64 id, struct perf_header *header);
67u64 perf_evlist__sample_type(struct perf_evlist *evlist);
68bool perf_evlist__sample_id_all(const struct perf_evlist *evlist);
87void perf_header__set_feat(struct perf_header *self, int feat);
88void perf_header__clear_feat(struct perf_header *self, int feat);
89bool perf_header__has_feat(const struct perf_header *self, int feat);
90
91int perf_header__process_sections(struct perf_header *self, int fd,
92 int (*process)(struct perf_file_section *self,
93 struct perf_header *ph,
94 int feat, int fd));
95
96int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
97 const char *name, bool is_kallsyms);
98int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
99
69void perf_header__set_feat(struct perf_header *self, int feat);
70void perf_header__clear_feat(struct perf_header *self, int feat);
71bool perf_header__has_feat(const struct perf_header *self, int feat);
72
73int perf_header__process_sections(struct perf_header *self, int fd,
74 int (*process)(struct perf_file_section *self,
75 struct perf_header *ph,
76 int feat, int fd));
77
78int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
79 const char *name, bool is_kallsyms);
80int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
81
100int event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
101 event__handler_t process,
102 struct perf_session *session);
103int event__synthesize_attrs(struct perf_header *self,
104 event__handler_t process,
105 struct perf_session *session);
106int event__process_attr(event_t *self, struct perf_session *session);
82int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
83 perf_event__handler_t process,
84 struct perf_session *session);
85int perf_session__synthesize_attrs(struct perf_session *session,
86 perf_event__handler_t process);
87int perf_event__process_attr(union perf_event *event, struct perf_session *session);
107
88
108int event__synthesize_event_type(u64 event_id, char *name,
109 event__handler_t process,
110 struct perf_session *session);
111int event__synthesize_event_types(event__handler_t process,
112 struct perf_session *session);
113int event__process_event_type(event_t *self,
114 struct perf_session *session);
115
116int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
117 event__handler_t process,
89int perf_event__synthesize_event_type(u64 event_id, char *name,
90 perf_event__handler_t process,
91 struct perf_session *session);
92int perf_event__synthesize_event_types(perf_event__handler_t process,
93 struct perf_session *session);
94int perf_event__process_event_type(union perf_event *event,
118 struct perf_session *session);
95 struct perf_session *session);
119int event__process_tracing_data(event_t *self,
120 struct perf_session *session);
121
96
122int event__synthesize_build_id(struct dso *pos, u16 misc,
123 event__handler_t process,
124 struct machine *machine,
125 struct perf_session *session);
126int event__process_build_id(event_t *self, struct perf_session *session);
97int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
98 perf_event__handler_t process,
99 struct perf_session *session);
100int perf_event__process_tracing_data(union perf_event *event,
101 struct perf_session *session);
127
102
103int perf_event__synthesize_build_id(struct dso *pos, u16 misc,
104 perf_event__handler_t process,
105 struct machine *machine,
106 struct perf_session *session);
107int perf_event__process_build_id(union perf_event *event,
108 struct perf_session *session);
128#endif /* __PERF_HEADER_H */
109#endif /* __PERF_HEADER_H */