cctools
rmonitor_poll_internal.h
1 /*
2 Copyright (C) 2013- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef RMONITOR_POLL_INTERNAL_H
8 #define RMONITOR_POLL_INTERNAL_H
9 
10 #include "itable.h"
11 #include "hash_table.h"
12 
13 #include "rmonitor_types.h"
14 #if defined(CCTOOLS_OPSYS_DARWIN)
15  #include <sys/param.h>
16  #include <sys/mount.h>
17  #include <sys/resource.h>
18 #else
19  #include <sys/vfs.h>
20 #endif
21 
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 
25 #ifdef HAS_SYS_STATFS_H
26 #include <sys/statfs.h>
27 #endif
28 
29 #ifdef HAS_SYS_STATVFS_H
30 #include <sys/statvfs.h>
31 #endif
32 
33 #include "int_sizes.h"
34 #include "rmonitor_types.h"
35 #include "rmsummary.h"
36 
37 #include "rmonitor_poll.h"
38 
39 void rmonitor_poll_all_processes_once(struct itable *processes, struct rmonitor_process_info *acc);
40 void rmonitor_poll_all_wds_once( struct hash_table *wdirs, struct rmonitor_wdir_info *acc, int max_time_for_measurement);
41 void rmonitor_poll_all_fss_once( struct itable *filesysms, struct rmonitor_filesys_info *acc);
42 
43 int rmonitor_poll_process_once(struct rmonitor_process_info *p);
44 int rmonitor_poll_wd_once( struct rmonitor_wdir_info *d, int max_time_for_measurement);
45 int rmonitor_poll_fs_once( struct rmonitor_filesys_info *f);
46 int rmonitor_poll_maps_once( struct itable *processes, struct rmonitor_mem_info *mem);
47 
48 void rmonitor_info_to_rmsummary(struct rmsummary *tr, struct rmonitor_process_info *p, struct rmonitor_wdir_info *d, struct rmonitor_filesys_info *f, uint64_t start_time);
49 
50 int rmonitor_get_cpu_time_usage(pid_t pid, struct rmonitor_cpu_time_info *cpu);
51 int rmonitor_get_ctxsw_usage( pid_t pid, struct rmonitor_ctxsw_info *ctx);
52 int rmonitor_get_mem_usage( pid_t pid, struct rmonitor_mem_info *mem);
53 int rmonitor_get_sys_io_usage( pid_t pid, struct rmonitor_io_info *io);
54 int rmonitor_get_map_io_usage( pid_t pid, struct rmonitor_io_info *io);
55 int rmonitor_get_dsk_usage( const char *path, struct statfs *disk);
56 
57 int rmonitor_get_loadavg(struct rmonitor_load_info *load);
58 
59 int rmonitor_get_wd_usage(struct rmonitor_wdir_info *d, int max_time_for_measurement);
60 
61 void acc_cpu_time_usage( struct rmonitor_cpu_time_info *acc, struct rmonitor_cpu_time_info *other);
62 void acc_ctxsw_usage( struct rmonitor_ctxsw_info *acc, struct rmonitor_ctxsw_info *other);
63 void acc_mem_usage( struct rmonitor_mem_info *acc, struct rmonitor_mem_info *other);
64 void acc_sys_io_usage( struct rmonitor_io_info *acc, struct rmonitor_io_info *other);
65 void acc_map_io_usage( struct rmonitor_io_info *acc, struct rmonitor_io_info *other);
66 void acc_dsk_usage( struct statfs *acc, struct statfs *other);
67 void acc_wd_usage( struct rmonitor_wdir_info *acc, struct rmonitor_wdir_info *other);
68 
69 FILE *open_proc_file(pid_t pid, char *filename);
70 int get_int_attribute(FILE *fstatus, char *attribute, uint64_t *value, int rewind_flag);
71 
72 uint64_t usecs_since_epoch();
73 
74 #endif
Definition: rmonitor_types.h:47
Definition: rmonitor_types.h:111
Definition: rmonitor_types.h:41
Definition: rmonitor_types.h:77
Definition: rmonitor_types.h:72
Definition: rmonitor_types.h:121
Definition: rmsummary.h:26
Definition: rmonitor_types.h:53
A general purpose hash table.
Definition: rmonitor_types.h:133
An integer-indexed hash table.