ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/statgrab.h (file contents):
Revision 1.30 by pajs, Sun Mar 28 18:07:30 2004 UTC vs.
Revision 1.38 by tdb, Wed Apr 7 09:44:08 2004 UTC

# Line 1 | Line 1
1   /*
2 < * i-scream central monitoring system
2 > * i-scream libstatgrab
3   * http://www.i-scream.org
4   * Copyright (C) 2000-2004 i-scream
5   *
# Line 23 | Line 23
23  
24   #include <sys/types.h>
25  
26 < typedef struct{
26 > /* FIXME typedefs for 32/64-bit types */
27 > /* FIXME maybe tidy up field names? */
28 > /* FIXME tab/space damage */
29 > /* FIXME prefixes for util functions too */
30 > /* FIXME comments for less obvious fields */
31 >
32 > int sg_init(void);
33 > int sg_drop_privileges(void);
34 >
35 > typedef enum {
36 >        SG_ERROR_NONE = 0,
37 >        SG_ERROR_MALLOC_FAILED
38 > } sg_error;
39 >
40 > void sg_set_error(sg_error code, const char *arg);
41 > sg_error sg_get_error();
42 > const char *sg_str_error(sg_error code);
43 >
44 > typedef struct {
45 >        char *os_name;
46 >        char *os_release;
47 >        char *os_version;
48 >        char *platform;
49 >        char *hostname;
50 >        time_t uptime;
51 > } sg_host_info;
52 >
53 > sg_host_info *sg_get_host_info();
54 >
55 > typedef struct {
56          long long user;
57          long long kernel;
58          long long idle;
# Line 32 | Line 61 | typedef struct{
61          long long nice;
62          long long total;
63          time_t systime;
64 < }cpu_states_t;
64 > } sg_cpu_stats;
65  
66 < typedef struct{
66 > sg_cpu_stats *sg_get_cpu_stats();
67 > sg_cpu_stats *sg_get_cpu_stats_diff();
68 >
69 > typedef struct {
70          float user;
71          float kernel;
72          float idle;
# Line 42 | Line 74 | typedef struct{
74          float swap;
75          float nice;
76          time_t time_taken;
77 < }cpu_percent_t;
77 > } sg_cpu_percents;
78  
79 < typedef struct{
79 > sg_cpu_percents *sg_get_cpu_percents();
80 >
81 > typedef struct {
82          long long total;
83          long long free;
84          long long used;
85          long long cache;
86 < }mem_stat_t;
86 > } sg_mem_stats;
87  
88 < typedef struct{
88 > sg_mem_stats *sg_get_mem_stats();
89 >
90 > typedef struct {
91          double min1;
92          double min5;
93          double min15;
94 < }load_stat_t;
94 > } sg_load_stats;
95  
96 < typedef struct{
96 > sg_load_stats *sg_get_load_stats();
97 >
98 > typedef struct {
99          char *name_list;
100          int num_entries;
101 < }user_stat_t;
101 > } sg_user_stats;
102  
103 < typedef struct{
103 > sg_user_stats *sg_get_user_stats();
104 >
105 > typedef struct {
106          long long total;
107          long long used;
108          long long free;
109 < }swap_stat_t;
109 > } sg_swap_stats;
110  
111 < typedef struct{
72 <        char *os_name;
73 <        char *os_release;
74 <        char *os_version;
75 <        char *platform;
76 <        char *hostname;
77 <        time_t uptime;
78 < }general_stat_t;
111 > sg_swap_stats *sg_get_swap_stats();
112  
113   typedef struct {
114          char *device_name;
# Line 87 | Line 120 | typedef struct {
120          long long total_inodes;
121          long long used_inodes;
122          long long free_inodes;
123 < }disk_stat_t;
123 > } sg_fs_stats;
124  
125 < typedef struct{
125 > sg_fs_stats *sg_get_fs_stats(int *entries);
126 >
127 > typedef struct {
128          char *disk_name;
129          long long read_bytes;
130          long long write_bytes;
131          time_t systime;
132 < }diskio_stat_t;
132 > } sg_disk_io_stats;
133  
134 < typedef struct{
135 <        int total;
101 <        int running;
102 <        int sleeping;
103 <        int stopped;
104 <        int zombie;
105 < }process_stat_t;
134 > sg_disk_io_stats *sg_get_disk_io_stats(int *entries);
135 > sg_disk_io_stats *sg_get_disk_io_stats_diff(int *entries);
136  
137 < typedef struct{
137 > typedef struct {
138          char *interface_name;
139          long long tx;
140          long long rx;
# Line 114 | Line 144 | typedef struct{
144          long long oerrors;
145          long long collisions;
146          time_t systime;
147 < }network_stat_t;
147 > } sg_network_io_stats;
148  
149 < typedef enum{
150 <        FULL_DUPLEX,
121 <        HALF_DUPLEX,
122 <        UNKNOWN_DUPLEX
123 < }statgrab_duplex;
149 > sg_network_io_stats *sg_get_network_io_stats(int *entries);
150 > sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
151  
152 < typedef struct{
152 > typedef enum {
153 >        SG_IFACE_DUPLEX_FULL,
154 >        SG_IFACE_DUPLEX_HALF,
155 >        SG_IFACE_DUPLEX_UNKNOWN
156 > } sg_iface_duplex;
157 >
158 > typedef struct {
159          char *interface_name;
160          int speed;      /* In megabits/sec */
161 <        statgrab_duplex dup;    
161 >        sg_iface_duplex dup;
162          int up;
163 < }network_iface_stat_t;
163 > } sg_network_iface_stats;
164  
165 < typedef struct{
165 > sg_network_iface_stats *sg_get_network_iface_stats(int *entries);
166 >
167 > typedef struct {
168          long long pages_pagein;
169          long long pages_pageout;
170          time_t systime;
171 < }page_stat_t;
171 > } sg_page_stats;
172  
173 < typedef enum{
174 <        RUNNING,
140 <        SLEEPING,
141 <        STOPPED,
142 <        ZOMBIE
143 < }process_status;
173 > sg_page_stats *sg_get_page_stats();
174 > sg_page_stats *sg_get_page_stats_diff();
175  
176 < typedef struct{
176 > typedef enum {
177 >        SG_PROCESS_STATE_RUNNING,
178 >        SG_PROCESS_STATE_SLEEPING,
179 >        SG_PROCESS_STATE_STOPPED,
180 >        SG_PROCESS_STATE_ZOMBIE,
181 >        SG_PROCESS_STATE_UNKNOWN
182 > } sg_process_state;
183 >
184 > typedef struct {
185          char *process_name;
186          char *proctitle;
187  
# Line 157 | Line 196 | typedef struct{
196  
197          unsigned long long proc_size; /* in bytes */
198          unsigned long long proc_resident; /* in bytes */
199 <        time_t time_spent;
199 >        time_t time_spent; /* time running in seconds */
200          double cpu_percent;
201          int nice;
202 <        process_status state;
203 < }proc_state_t;
202 >        sg_process_state state;
203 > } sg_process_stats;
204  
205 < int get_proc_snapshot(proc_state_t **proc_state);
205 > sg_process_stats *sg_get_process_stats(int *entries);
206  
207 < cpu_states_t *get_cpu_totals();
208 < cpu_states_t *get_cpu_diff();
209 < cpu_percent_t *cpu_percent_usage();
207 > typedef struct {
208 >        int total;
209 >        int running;
210 >        int sleeping;
211 >        int stopped;
212 >        int zombie;
213 > } sg_process_count;
214  
215 < mem_stat_t *get_memory_stats();
215 > sg_process_count *sg_get_process_count();
216  
217 < load_stat_t *get_load_stats();
218 <
219 < user_stat_t *get_user_stats();
177 <
178 < swap_stat_t *get_swap_stats();
179 <
180 < general_stat_t *get_general_stats();
181 <
182 < disk_stat_t *get_disk_stats(int *entries);
183 < diskio_stat_t *get_diskio_stats(int *entries);
184 < diskio_stat_t *get_diskio_stats_diff(int *entries);
185 <
186 < process_stat_t *get_process_stats();
187 <
188 < network_stat_t *get_network_stats(int *entries);
189 < network_stat_t *get_network_stats_diff(int *entries);
190 <
191 < network_iface_stat_t *get_network_iface_stats(int *entries);
192 <
193 < page_stat_t *get_page_stats();
194 < page_stat_t *get_page_stats_diff();
195 <
196 < int statgrab_init(void);
197 < int statgrab_drop_privileges(void);
217 > #ifdef SG_ENABLE_DEPRECATED
218 > #include <statgrab_deprecated.h>
219 > #endif
220  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines