]> Git Repo - linux.git/blob - tools/perf/util/data.h
Merge tag 'perf-core-for-mingo-4.15-20171103' of git://git.kernel.org/pub/scm/linux...
[linux.git] / tools / perf / util / data.h
1 #ifndef __PERF_DATA_H
2 #define __PERF_DATA_H
3
4 #include <stdbool.h>
5
6 enum perf_data_mode {
7         PERF_DATA_MODE_WRITE,
8         PERF_DATA_MODE_READ,
9 };
10
11 struct perf_data_file {
12         const char      *path;
13         int              fd;
14 };
15
16 struct perf_data {
17         struct perf_data_file    file;
18         bool                     is_pipe;
19         bool                     force;
20         unsigned long            size;
21         enum perf_data_mode      mode;
22 };
23
24 static inline bool perf_data__is_read(struct perf_data *data)
25 {
26         return data->mode == PERF_DATA_MODE_READ;
27 }
28
29 static inline bool perf_data__is_write(struct perf_data *data)
30 {
31         return data->mode == PERF_DATA_MODE_WRITE;
32 }
33
34 static inline int perf_data__is_pipe(struct perf_data *data)
35 {
36         return data->is_pipe;
37 }
38
39 static inline int perf_data__fd(struct perf_data *data)
40 {
41         return data->file.fd;
42 }
43
44 static inline unsigned long perf_data__size(struct perf_data *data)
45 {
46         return data->size;
47 }
48
49 int perf_data__open(struct perf_data *data);
50 void perf_data__close(struct perf_data *data);
51 ssize_t perf_data__write(struct perf_data *data,
52                               void *buf, size_t size);
53 ssize_t perf_data_file__write(struct perf_data_file *file,
54                               void *buf, size_t size);
55 /*
56  * If at_exit is set, only rename current perf.data to
57  * perf.data.<postfix>, continue write on original data.
58  * Set at_exit when flushing the last output.
59  *
60  * Return value is fd of new output.
61  */
62 int perf_data__switch(struct perf_data *data,
63                            const char *postfix,
64                            size_t pos, bool at_exit);
65 #endif /* __PERF_DATA_H */
This page took 0.031795 seconds and 4 git commands to generate.