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*/
38enum 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 accumulated;
50 uint64_t delta;
51};
52
54{
55 uint64_t virtual;
56 uint64_t referenced;
57 uint64_t resident;
58 uint64_t swap;
59
60 /* resident values, itemized. */
61 uint64_t private;
62 uint64_t shared;
63
64 char *map_name;
65 uint64_t map_start;
66 uint64_t map_end;
67
68 uint64_t text;
69 uint64_t data;
70};
71
73 uint64_t last_minute;
74 uint64_t cpus;
75};
76
78{
79 uint64_t chars_read;
80 uint64_t chars_written;
81
82 uint64_t bytes_faulted;
83
84 uint64_t delta_chars_read;
85 uint64_t delta_chars_written;
86
87 uint64_t delta_bytes_faulted;
88};
89
91{
92 uint64_t start;
93 uint64_t end;
94 uint64_t bit_count;
95};
96
98{
99 uint64_t n_references;
100 uint64_t n_opens;
101 uint64_t n_closes;
102 uint64_t n_reads;
103 uint64_t n_writes;
104 int is_output;
105 off_t size_on_open; /* in bytes */
106 off_t size_on_close; /* in bytes */
107 dev_t device;
108};
109
110
112{
113 char *path;
114 int files;
115 off_t byte_count;
116
117 struct path_disk_size_info *state;
118 struct rmonitor_filesys_info *fs;
119};
120
122{
123 int id;
124 char *path; // Sample path on the filesystem.
125 struct statfs disk; // Current result of statfs call minus disk_initial.
126 struct statfs disk_initial; // Result of the first time we call statfs.
127
128 int initial_loaded_flag; // Flag to indicate whether statfs has been called
129 // already on this fs (that is, whether disk_initial
130 // has a valid value).
131};
132
134{
135 pid_t pid;
136 const char *cmd;
137 int running;
138 int waiting;
139
140 struct rmonitor_mem_info mem;
141 struct rmonitor_cpu_time_info cpu;
142 struct rmonitor_ctxsw_info ctx;
143 struct rmonitor_io_info io;
144 struct rmonitor_load_info load;
145 struct rmonitor_wdir_info *wd;
146};
147
148#endif
Query disk space on the given directory.
Definition path_disk_size_info.h:13
Definition rmonitor_types.h:91
Definition rmonitor_types.h:42
Definition rmonitor_types.h:48
Definition rmonitor_types.h:98
Definition rmonitor_types.h:122
Definition rmonitor_types.h:78
Definition rmonitor_types.h:72
Definition rmonitor_types.h:54
Definition rmonitor_types.h:134
Definition rmonitor_types.h:112