~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/data.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __PERF_DATA_H
  3 #define __PERF_DATA_H
  4 
  5 #include <stdio.h>
  6 #include <stdbool.h>
  7 #include <unistd.h>
  8 #include <linux/types.h>
  9 
 10 enum perf_data_mode {
 11         PERF_DATA_MODE_WRITE,
 12         PERF_DATA_MODE_READ,
 13 };
 14 
 15 enum perf_dir_version {
 16         PERF_DIR_SINGLE_FILE    = 0,
 17         PERF_DIR_VERSION        = 1,
 18 };
 19 
 20 struct perf_data_file {
 21         char            *path;
 22         union {
 23                 int      fd;
 24                 FILE    *fptr;
 25         };
 26         unsigned long    size;
 27 };
 28 
 29 struct perf_data {
 30         const char              *path;
 31         struct perf_data_file    file;
 32         bool                     is_pipe;
 33         bool                     is_dir;
 34         bool                     force;
 35         bool                     use_stdio;
 36         bool                     in_place_update;
 37         enum perf_data_mode      mode;
 38 
 39         struct {
 40                 u64                      version;
 41                 struct perf_data_file   *files;
 42                 int                      nr;
 43         } dir;
 44 };
 45 
 46 static inline bool perf_data__is_read(struct perf_data *data)
 47 {
 48         return data->mode == PERF_DATA_MODE_READ;
 49 }
 50 
 51 static inline bool perf_data__is_write(struct perf_data *data)
 52 {
 53         return data->mode == PERF_DATA_MODE_WRITE;
 54 }
 55 
 56 static inline int perf_data__is_pipe(struct perf_data *data)
 57 {
 58         return data->is_pipe;
 59 }
 60 
 61 static inline bool perf_data__is_dir(struct perf_data *data)
 62 {
 63         return data->is_dir;
 64 }
 65 
 66 static inline bool perf_data__is_single_file(struct perf_data *data)
 67 {
 68         return data->dir.version == PERF_DIR_SINGLE_FILE;
 69 }
 70 
 71 static inline int perf_data__fd(struct perf_data *data)
 72 {
 73         if (data->use_stdio)
 74                 return fileno(data->file.fptr);
 75 
 76         return data->file.fd;
 77 }
 78 
 79 int perf_data__open(struct perf_data *data);
 80 void perf_data__close(struct perf_data *data);
 81 ssize_t perf_data__read(struct perf_data *data, void *buf, size_t size);
 82 ssize_t perf_data__write(struct perf_data *data,
 83                          void *buf, size_t size);
 84 ssize_t perf_data_file__write(struct perf_data_file *file,
 85                               void *buf, size_t size);
 86 /*
 87  * If at_exit is set, only rename current perf.data to
 88  * perf.data.<postfix>, continue write on original data.
 89  * Set at_exit when flushing the last output.
 90  *
 91  * Return value is fd of new output.
 92  */
 93 int perf_data__switch(struct perf_data *data,
 94                       const char *postfix,
 95                       size_t pos, bool at_exit, char **new_filepath);
 96 
 97 int perf_data__create_dir(struct perf_data *data, int nr);
 98 int perf_data__open_dir(struct perf_data *data);
 99 void perf_data__close_dir(struct perf_data *data);
100 int perf_data__update_dir(struct perf_data *data);
101 unsigned long perf_data__size(struct perf_data *data);
102 int perf_data__make_kcore_dir(struct perf_data *data, char *buf, size_t buf_sz);
103 bool has_kcore_dir(const char *path);
104 char *perf_data__kallsyms_name(struct perf_data *data);
105 char *perf_data__guest_kallsyms_name(struct perf_data *data, pid_t machine_pid);
106 bool is_perf_data(const char *path);
107 #endif /* __PERF_DATA_H */
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php