.. | .. |
---|
3 | 3 | #define __PERF_DATA_H |
---|
4 | 4 | |
---|
5 | 5 | #include <stdbool.h> |
---|
| 6 | +#include <linux/types.h> |
---|
6 | 7 | |
---|
7 | 8 | enum perf_data_mode { |
---|
8 | 9 | PERF_DATA_MODE_WRITE, |
---|
9 | 10 | PERF_DATA_MODE_READ, |
---|
10 | 11 | }; |
---|
11 | 12 | |
---|
| 13 | +enum perf_dir_version { |
---|
| 14 | + PERF_DIR_SINGLE_FILE = 0, |
---|
| 15 | + PERF_DIR_VERSION = 1, |
---|
| 16 | +}; |
---|
| 17 | + |
---|
12 | 18 | struct perf_data_file { |
---|
13 | | - const char *path; |
---|
| 19 | + char *path; |
---|
14 | 20 | int fd; |
---|
| 21 | + unsigned long size; |
---|
15 | 22 | }; |
---|
16 | 23 | |
---|
17 | 24 | struct perf_data { |
---|
| 25 | + const char *path; |
---|
18 | 26 | struct perf_data_file file; |
---|
19 | 27 | bool is_pipe; |
---|
| 28 | + bool is_dir; |
---|
20 | 29 | bool force; |
---|
21 | | - unsigned long size; |
---|
22 | 30 | enum perf_data_mode mode; |
---|
| 31 | + |
---|
| 32 | + struct { |
---|
| 33 | + u64 version; |
---|
| 34 | + struct perf_data_file *files; |
---|
| 35 | + int nr; |
---|
| 36 | + } dir; |
---|
23 | 37 | }; |
---|
24 | 38 | |
---|
25 | 39 | static inline bool perf_data__is_read(struct perf_data *data) |
---|
.. | .. |
---|
37 | 51 | return data->is_pipe; |
---|
38 | 52 | } |
---|
39 | 53 | |
---|
| 54 | +static inline bool perf_data__is_dir(struct perf_data *data) |
---|
| 55 | +{ |
---|
| 56 | + return data->is_dir; |
---|
| 57 | +} |
---|
| 58 | + |
---|
| 59 | +static inline bool perf_data__is_single_file(struct perf_data *data) |
---|
| 60 | +{ |
---|
| 61 | + return data->dir.version == PERF_DIR_SINGLE_FILE; |
---|
| 62 | +} |
---|
| 63 | + |
---|
40 | 64 | static inline int perf_data__fd(struct perf_data *data) |
---|
41 | 65 | { |
---|
42 | 66 | return data->file.fd; |
---|
43 | | -} |
---|
44 | | - |
---|
45 | | -static inline unsigned long perf_data__size(struct perf_data *data) |
---|
46 | | -{ |
---|
47 | | - return data->size; |
---|
48 | 67 | } |
---|
49 | 68 | |
---|
50 | 69 | int perf_data__open(struct perf_data *data); |
---|
.. | .. |
---|
62 | 81 | */ |
---|
63 | 82 | int perf_data__switch(struct perf_data *data, |
---|
64 | 83 | const char *postfix, |
---|
65 | | - size_t pos, bool at_exit); |
---|
| 84 | + size_t pos, bool at_exit, char **new_filepath); |
---|
| 85 | + |
---|
| 86 | +int perf_data__create_dir(struct perf_data *data, int nr); |
---|
| 87 | +int perf_data__open_dir(struct perf_data *data); |
---|
| 88 | +void perf_data__close_dir(struct perf_data *data); |
---|
| 89 | +int perf_data__update_dir(struct perf_data *data); |
---|
| 90 | +unsigned long perf_data__size(struct perf_data *data); |
---|
| 91 | +int perf_data__make_kcore_dir(struct perf_data *data, char *buf, size_t buf_sz); |
---|
| 92 | +char *perf_data__kallsyms_name(struct perf_data *data); |
---|
66 | 93 | #endif /* __PERF_DATA_H */ |
---|