cctools
rmonitor_types.h
1 #if defined(CCTOOLS_OPSYS_DARWIN) || defined(CCTOOLS_OPSYS_FREEBSD)
2  #include <sys/param.h>
3  #include <sys/mount.h>
4  #include <sys/resource.h>
5 #else
6  #include <sys/vfs.h>
7 #endif
8 
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 
12 #ifdef HAS_SYS_STATFS_H
13 #include <sys/statfs.h>
14 #endif
15 
16 #ifdef HAS_SYS_STATVFS_H
17 #include <sys/statvfs.h>
18 #endif
19 
20 #include "path_disk_size_info.h"
21 
22 #include "int_sizes.h"
23 
24 #ifndef RMONITOR_TYPES_H
25 #define RMONITOR_TYPES_H
26 
27 #define ONE_MEGABYTE 1048576 /* this many bytes */
28 #define ONE_SECOND 1000000 /* this many usecs */
29 
30 #define MAX_FILE_DESCRIPTOR_COUNT 500 /* maximum depth of file tree walking */
31 
32 /* RM_SUCCESS: task exit status is zero, and the monitor did not have any errors
33  * RM_TASK_ERROR: task exit status is non-zero, and the monitor did not have any errors
34  * RM_OVERFLOW: task used more resources than the limits specified, and was terminated
35  * RM_TIME_EXPIRE: task started or ended before or after 'start' and 'end' times, respectively.
36  * RM_MONITOR_ERROR: monitor could not execute the task
37 */
38 enum rmonitor_errors { RM_SUCCESS, RM_TASK_ERROR, RM_OVERFLOW, RM_TIME_EXPIRE, RM_MONITOR_ERROR };
39 
40 //time in usecs, no seconds:
42 {
43  uint64_t accumulated;
44  uint64_t delta;
45 };
46 
48 {
49  uint64_t virtual;
50  uint64_t referenced;
51  uint64_t resident;
52  uint64_t swap;
53 
54  /* resident values, itemized. */
55  uint64_t private;
56  uint64_t shared;
57 
58  char *map_name;
59  uint64_t map_start;
60  uint64_t map_end;
61 
62  uint64_t text;
63  uint64_t data;
64 };
65 
67  uint64_t last_minute;
68  uint64_t cpus;
69 };
70 
72 {
73  uint64_t chars_read;
74  uint64_t chars_written;
75 
76  uint64_t bytes_faulted;
77 
78  uint64_t delta_chars_read;
79  uint64_t delta_chars_written;
80 
81  uint64_t delta_bytes_faulted;
82 };
83 
85 {
86  uint64_t start;
87  uint64_t end;
88  uint64_t bit_count;
89 };
90 
92 {
93  uint64_t n_references;
94  uint64_t n_opens;
95  uint64_t n_closes;
96  uint64_t n_reads;
97  uint64_t n_writes;
98  int is_output;
99  off_t size_on_open; /* in bytes */
100  off_t size_on_close; /* in bytes */
101  dev_t device;
102 };
103 
104 
106 {
107  char *path;
108  int files;
109  off_t byte_count;
110 
111  struct path_disk_size_info *state;
112  struct rmonitor_filesys_info *fs;
113 };
114 
116 {
117  int id;
118  char *path; // Sample path on the filesystem.
119  struct statfs disk; // Current result of statfs call minus disk_initial.
120  struct statfs disk_initial; // Result of the first time we call statfs.
121 
122  int initial_loaded_flag; // Flag to indicate whether statfs has been called
123  // already on this fs (that is, whether disk_initial
124  // has a valid value).
125 };
126 
128 {
129  pid_t pid;
130  const char *cmd;
131  int running;
132  int waiting;
133 
134  struct rmonitor_mem_info mem;
135  struct rmonitor_cpu_time_info cpu;
136  struct rmonitor_io_info io;
137  struct rmonitor_load_info load;
138  struct rmonitor_wdir_info *wd;
139 };
140 
141 #endif
Definition: rmonitor_types.h:105
Definition: rmonitor_types.h:41
Definition: rmonitor_types.h:71
Definition: rmonitor_types.h:84
Definition: rmonitor_types.h:66
Definition: rmonitor_types.h:115
Definition: path_disk_size_info.h:13
Definition: rmonitor_types.h:91
Definition: rmonitor_types.h:47
Definition: rmonitor_types.h:127
Query disk space on the given directory.