1 /* SPDX-License-Identifier: GPL-2.0 */
12 struct perf_data_file
{
18 struct perf_data_file file
;
22 enum perf_data_mode mode
;
25 static inline bool perf_data__is_read(struct perf_data
*data
)
27 return data
->mode
== PERF_DATA_MODE_READ
;
30 static inline bool perf_data__is_write(struct perf_data
*data
)
32 return data
->mode
== PERF_DATA_MODE_WRITE
;
35 static inline int perf_data__is_pipe(struct perf_data
*data
)
40 static inline int perf_data__fd(struct perf_data
*data
)
45 static inline unsigned long perf_data__size(struct perf_data
*data
)
50 int perf_data__open(struct perf_data
*data
);
51 void perf_data__close(struct perf_data
*data
);
52 ssize_t
perf_data__write(struct perf_data
*data
,
53 void *buf
, size_t size
);
54 ssize_t
perf_data_file__write(struct perf_data_file
*file
,
55 void *buf
, size_t size
);
57 * If at_exit is set, only rename current perf.data to
58 * perf.data.<postfix>, continue write on original data.
59 * Set at_exit when flushing the last output.
61 * Return value is fd of new output.
63 int perf_data__switch(struct perf_data
*data
,
65 size_t pos
, bool at_exit
);
66 #endif /* __PERF_DATA_H */