spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / tools / perf / util / header.h
blobac4ec956024e2eb17552860a36b231576701c56d
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_RESERVED = 0, /* always cleared */
14 HEADER_TRACE_INFO = 1,
15 HEADER_BUILD_ID,
17 HEADER_HOSTNAME,
18 HEADER_OSRELEASE,
19 HEADER_VERSION,
20 HEADER_ARCH,
21 HEADER_NRCPUS,
22 HEADER_CPUDESC,
23 HEADER_CPUID,
24 HEADER_TOTAL_MEM,
25 HEADER_CMDLINE,
26 HEADER_EVENT_DESC,
27 HEADER_CPU_TOPOLOGY,
28 HEADER_NUMA_TOPOLOGY,
30 HEADER_LAST_FEATURE,
31 HEADER_FEAT_BITS = 256,
34 struct perf_file_section {
35 u64 offset;
36 u64 size;
39 struct perf_file_header {
40 u64 magic;
41 u64 size;
42 u64 attr_size;
43 struct perf_file_section attrs;
44 struct perf_file_section data;
45 struct perf_file_section event_types;
46 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
49 struct perf_pipe_file_header {
50 u64 magic;
51 u64 size;
54 struct perf_header;
56 int perf_file_header__read(struct perf_file_header *header,
57 struct perf_header *ph, int fd);
59 struct perf_header {
60 int frozen;
61 bool needs_swap;
62 s64 attr_offset;
63 u64 data_offset;
64 u64 data_size;
65 u64 event_offset;
66 u64 event_size;
67 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
70 struct perf_evlist;
71 struct perf_session;
73 int perf_session__read_header(struct perf_session *session, int fd);
74 int perf_session__write_header(struct perf_session *session,
75 struct perf_evlist *evlist,
76 int fd, bool at_exit);
77 int perf_header__write_pipe(int fd);
79 int perf_header__push_event(u64 id, const char *name);
80 char *perf_header__find_event(u64 id);
82 void perf_header__set_feat(struct perf_header *header, int feat);
83 void perf_header__clear_feat(struct perf_header *header, int feat);
84 bool perf_header__has_feat(const struct perf_header *header, int feat);
86 int perf_header__set_cmdline(int argc, const char **argv);
88 int perf_header__process_sections(struct perf_header *header, int fd,
89 void *data,
90 int (*process)(struct perf_file_section *section,
91 struct perf_header *ph,
92 int feat, int fd, void *data));
94 int perf_header__fprintf_info(struct perf_session *s, FILE *fp, bool full);
96 int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
97 const char *name, bool is_kallsyms);
98 int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
100 int perf_event__synthesize_attr(struct perf_tool *tool,
101 struct perf_event_attr *attr, u16 ids, u64 *id,
102 perf_event__handler_t process);
103 int perf_event__synthesize_attrs(struct perf_tool *tool,
104 struct perf_session *session,
105 perf_event__handler_t process);
106 int perf_event__process_attr(union perf_event *event, struct perf_evlist **pevlist);
108 int perf_event__synthesize_event_type(struct perf_tool *tool,
109 u64 event_id, char *name,
110 perf_event__handler_t process,
111 struct machine *machine);
112 int perf_event__synthesize_event_types(struct perf_tool *tool,
113 perf_event__handler_t process,
114 struct machine *machine);
115 int perf_event__process_event_type(struct perf_tool *tool,
116 union perf_event *event);
118 int perf_event__synthesize_tracing_data(struct perf_tool *tool,
119 int fd, struct perf_evlist *evlist,
120 perf_event__handler_t process);
121 int perf_event__process_tracing_data(union perf_event *event,
122 struct perf_session *session);
124 int perf_event__synthesize_build_id(struct perf_tool *tool,
125 struct dso *pos, u16 misc,
126 perf_event__handler_t process,
127 struct machine *machine);
128 int perf_event__process_build_id(struct perf_tool *tool,
129 union perf_event *event,
130 struct perf_session *session);
133 * arch specific callback
135 int get_cpuid(char *buffer, size_t sz);
137 #endif /* __PERF_HEADER_H */