rmonitor_types.h

00001 #if defined(CCTOOLS_OPSYS_DARWIN) || defined(CCTOOLS_OPSYS_FREEBSD)
00002   #include <sys/param.h>
00003   #include <sys/mount.h>
00004   #include <sys/resource.h>
00005 #else
00006   #include  <sys/vfs.h>
00007 #endif
00008 
00009 #include <sys/types.h>
00010 #include <sys/stat.h>
00011 
00012 #ifdef HAS_SYS_STATFS_H
00013 #include <sys/statfs.h>
00014 #endif
00015 
00016 #ifdef HAS_SYS_STATVFS_H
00017 #include <sys/statvfs.h>
00018 #endif
00019 
00020 #include "path_disk_size_info.h"
00021 
00022 #include "int_sizes.h"
00023 
00024 #ifndef RMONITOR_TYPES_H
00025 #define RMONITOR_TYPES_H
00026 
00027 #define ONE_MEGABYTE 1048576  /* this many bytes */
00028 #define ONE_SECOND   1000000  /* this many usecs */
00029 
00030 #define MAX_FILE_DESCRIPTOR_COUNT 500 /* maximum depth of file tree walking */
00031 
00032 /* RM_SUCCESS:     task exit status is zero, and the monitor did not have any errors
00033  * RM_TASK_ERROR:  task exit status is non-zero, and the monitor did not have any errors
00034  * RM_OVERFLOW:    task used more resources than the limits specified, and was terminated
00035  * RM_TIME_EXPIRE: task started or ended before or after 'start' and 'end' times, respectively.
00036  * RM_MONITOR_ERROR: monitor could not execute the task
00037 */
00038 enum rmonitor_errors { RM_SUCCESS, RM_TASK_ERROR, RM_OVERFLOW, RM_TIME_EXPIRE, RM_MONITOR_ERROR };
00039 
00040 //time in usecs, no seconds:
00041 struct rmonitor_cpu_time_info
00042 {
00043         uint64_t accumulated;
00044         uint64_t delta;
00045 };
00046 
00047 struct rmonitor_mem_info
00048 {
00049         uint64_t virtual;
00050         uint64_t referenced;
00051         uint64_t resident;
00052         uint64_t swap;
00053 
00054         /* resident values, itemized. */
00055         uint64_t private;
00056         uint64_t shared;
00057 
00058         char    *map_name;
00059         uint64_t map_start;
00060         uint64_t map_end;
00061 
00062         uint64_t text;
00063         uint64_t data;
00064 };
00065 
00066 struct rmonitor_load_info {
00067     uint64_t last_minute;
00068     uint64_t cpus;
00069 };
00070 
00071 struct rmonitor_io_info
00072 {
00073         uint64_t chars_read;
00074         uint64_t chars_written;
00075 
00076         uint64_t bytes_faulted;
00077 
00078         uint64_t delta_chars_read;
00079         uint64_t delta_chars_written;
00080 
00081         uint64_t delta_bytes_faulted;
00082 };
00083 
00084 struct rmonitor_bw_info
00085 {
00086         uint64_t start;
00087         uint64_t end;
00088         uint64_t bit_count;
00089 };
00090 
00091 struct rmonitor_file_info
00092 {
00093         uint64_t n_references;
00094         uint64_t n_opens;
00095         uint64_t n_closes;
00096         uint64_t n_reads;
00097         uint64_t n_writes;
00098         int      is_output;
00099         off_t size_on_open;            /* in bytes */
00100         off_t size_on_close;           /* in bytes */
00101         dev_t device;
00102 };
00103 
00104 
00105 struct rmonitor_wdir_info
00106 {
00107         char     *path;
00108         int      files;
00109         off_t    byte_count;
00110 
00111         struct path_disk_size_info *state;
00112         struct rmonitor_filesys_info *fs;
00113 };
00114 
00115 struct rmonitor_filesys_info
00116 {
00117         int             id;
00118         char           *path;            // Sample path on the filesystem.
00119         struct statfs   disk;            // Current result of statfs call minus disk_initial.
00120         struct statfs   disk_initial;    // Result of the first time we call statfs.
00121 
00122         int initial_loaded_flag;         // Flag to indicate whether statfs has been called
00123                                                                          // already on this fs (that is, whether disk_initial
00124                                                                          // has a valid value).
00125 };
00126 
00127 struct rmonitor_process_info
00128 {
00129         pid_t       pid;
00130         const char *cmd;
00131         int         running;
00132         int         waiting;
00133 
00134         struct rmonitor_mem_info      mem;
00135         struct rmonitor_cpu_time_info cpu;
00136         struct rmonitor_io_info       io;
00137         struct rmonitor_load_info     load;
00138         struct rmonitor_wdir_info    *wd;
00139 };
00140 
00141 #endif

Generated on 17 Sep 2019 for cctools by  doxygen 1.6.1