blob: a0761bc7863c7e2ba7ad644751fa668c092a67a6 [file] [log] [blame]
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +02001#ifndef _PERF_HEADER_H
2#define _PERF_HEADER_H
3
Ingo Molnarcdd6c482009-09-21 12:02:48 +02004#include "../../../include/linux/perf_event.h"
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +02005#include <sys/types.h>
6#include "types.h"
7
8struct perf_header_attr {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02009 struct perf_event_attr attr;
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020010 int ids, size;
11 u64 *id;
12 off_t id_offset;
13};
14
15struct perf_header {
16 int frozen;
17 int attrs, size;
18 struct perf_header_attr **attr;
Arjan van de Vendfe5a502009-07-20 22:54:26 -070019 s64 attr_offset;
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020020 u64 data_offset;
21 u64 data_size;
Arjan van de Ven8755a8f2009-09-12 07:52:51 +020022 u64 event_offset;
23 u64 event_size;
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020024};
25
26struct perf_header *perf_header__read(int fd);
27void perf_header__write(struct perf_header *self, int fd);
28
29void perf_header__add_attr(struct perf_header *self,
30 struct perf_header_attr *attr);
31
Arjan van de Ven8755a8f2009-09-12 07:52:51 +020032void perf_header__push_event(u64 id, const char *name);
33char *perf_header__find_event(u64 id);
34
35
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020036struct perf_header_attr *
Ingo Molnarcdd6c482009-09-21 12:02:48 +020037perf_header_attr__new(struct perf_event_attr *attr);
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020038void perf_header_attr__add_id(struct perf_header_attr *self, u64 id);
39
Frederic Weisbecker0d3a5c82009-08-16 20:56:37 +020040u64 perf_header__sample_type(struct perf_header *header);
Ingo Molnarcdd6c482009-09-21 12:02:48 +020041struct perf_event_attr *
Frederic Weisbecker0d3a5c82009-08-16 20:56:37 +020042perf_header__find_attr(u64 id, struct perf_header *header);
43
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +020044
45struct perf_header *perf_header__new(void);
46
47#endif /* _PERF_HEADER_H */