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_MONITOR_ERROR: monitor could not execute the task
00036 */
00037 enum rmonitor_errors { RM_SUCCESS, RM_TASK_ERROR, RM_OVERFLOW, RM_MONITOR_ERROR };
00038 
00039 //time in usecs, no seconds:
00040 struct rmonitor_cpu_time_info
00041 {
00042         uint64_t accumulated;
00043         uint64_t delta;
00044 };
00045 
00046 struct rmonitor_mem_info
00047 {
00048         uint64_t virtual;
00049         uint64_t referenced;
00050         uint64_t resident;
00051         uint64_t swap;
00052 
00053         /* resident values, itemized. */
00054         uint64_t private;
00055         uint64_t shared;
00056 
00057         char    *map_name;
00058         uint64_t map_start;
00059         uint64_t map_end;
00060 
00061         uint64_t text;
00062         uint64_t data;
00063 };
00064 
00065 struct rmonitor_io_info
00066 {
00067         uint64_t chars_read;
00068         uint64_t chars_written;
00069 
00070         uint64_t bytes_faulted;
00071 
00072         uint64_t delta_chars_read;
00073         uint64_t delta_chars_written;
00074 
00075         uint64_t delta_bytes_faulted;
00076 };
00077 
00078 struct rmonitor_bw_info
00079 {
00080         uint64_t start;
00081         uint64_t end;
00082         uint64_t bit_count;
00083 };
00084 
00085 struct rmonitor_file_info
00086 {
00087         uint64_t n_references;
00088         uint64_t n_opens;
00089         uint64_t n_closes;
00090         uint64_t n_reads;
00091         uint64_t n_writes;
00092         int      is_output;
00093         off_t size_on_open;            /* in bytes */
00094         off_t size_on_close;           /* in bytes */
00095         dev_t device;
00096 };
00097 
00098 
00099 struct rmonitor_wdir_info
00100 {
00101         char     *path;
00102         int      files;
00103         off_t    byte_count;
00104 
00105         struct path_disk_size_info *state;
00106         struct rmonitor_filesys_info *fs;
00107 };
00108 
00109 struct rmonitor_filesys_info
00110 {
00111         int             id;
00112         char           *path;            // Sample path on the filesystem.
00113         struct statfs   disk;            // Current result of statfs call minus disk_initial.
00114         struct statfs   disk_initial;    // Result of the first time we call statfs.
00115 
00116         int initial_loaded_flag;         // Flag to indicate whether statfs has been called
00117                                                                          // already on this fs (that is, whether disk_initial
00118                                                                          // has a valid value).
00119 };
00120 
00121 struct rmonitor_process_info
00122 {
00123         pid_t       pid;
00124         const char *cmd;
00125         int         running;
00126         int         waiting;
00127 
00128         struct rmonitor_mem_info      mem;
00129         struct rmonitor_cpu_time_info cpu;
00130         struct rmonitor_io_info       io;
00131         struct rmonitor_wdir_info    *wd;
00132 };
00133 
00134 #endif

Generated on 24 Feb 2016 for cctools by  doxygen 1.6.1