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_io_info
00067 {
00068         uint64_t chars_read;
00069         uint64_t chars_written;
00070 
00071         uint64_t bytes_faulted;
00072 
00073         uint64_t delta_chars_read;
00074         uint64_t delta_chars_written;
00075 
00076         uint64_t delta_bytes_faulted;
00077 };
00078 
00079 struct rmonitor_bw_info
00080 {
00081         uint64_t start;
00082         uint64_t end;
00083         uint64_t bit_count;
00084 };
00085 
00086 struct rmonitor_file_info
00087 {
00088         uint64_t n_references;
00089         uint64_t n_opens;
00090         uint64_t n_closes;
00091         uint64_t n_reads;
00092         uint64_t n_writes;
00093         int      is_output;
00094         off_t size_on_open;            /* in bytes */
00095         off_t size_on_close;           /* in bytes */
00096         dev_t device;
00097 };
00098 
00099 
00100 struct rmonitor_wdir_info
00101 {
00102         char     *path;
00103         int      files;
00104         off_t    byte_count;
00105 
00106         struct path_disk_size_info *state;
00107         struct rmonitor_filesys_info *fs;
00108 };
00109 
00110 struct rmonitor_filesys_info
00111 {
00112         int             id;
00113         char           *path;            // Sample path on the filesystem.
00114         struct statfs   disk;            // Current result of statfs call minus disk_initial.
00115         struct statfs   disk_initial;    // Result of the first time we call statfs.
00116 
00117         int initial_loaded_flag;         // Flag to indicate whether statfs has been called
00118                                                                          // already on this fs (that is, whether disk_initial
00119                                                                          // has a valid value).
00120 };
00121 
00122 struct rmonitor_process_info
00123 {
00124         pid_t       pid;
00125         const char *cmd;
00126         int         running;
00127         int         waiting;
00128 
00129         struct rmonitor_mem_info      mem;
00130         struct rmonitor_cpu_time_info cpu;
00131         struct rmonitor_io_info       io;
00132         struct rmonitor_wdir_info    *wd;
00133 };
00134 
00135 #endif

Generated on 21 Nov 2016 for cctools by  doxygen 1.6.1