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.33 by ats, Mon Apr 5 15:40:15 2004 UTC vs.
Revision 1.56 by tdb, Wed Jul 13 13:01:24 2005 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 21 | Line 21
21   * $Id$
22   */
23  
24 + #ifndef STATGRAB_H
25 + #define STATGRAB_H
26 +
27   #include <sys/types.h>
28  
29   /* FIXME typedefs for 32/64-bit types */
30   /* FIXME maybe tidy up field names? */
28 /* FIXME tab/space damage */
29 /* FIXME prefixes for util functions too */
31   /* FIXME comments for less obvious fields */
32  
33   int sg_init(void);
34   int sg_drop_privileges(void);
35  
36 + typedef enum {
37 +        SG_ERROR_NONE = 0,
38 +        SG_ERROR_ASPRINTF,
39 +        SG_ERROR_DEVSTAT_GETDEVS,
40 +        SG_ERROR_DEVSTAT_SELECTDEVS,
41 +        SG_ERROR_ENOENT,
42 +        SG_ERROR_GETIFADDRS,
43 +        SG_ERROR_GETMNTINFO,
44 +        SG_ERROR_GETPAGESIZE,
45 +        SG_ERROR_KSTAT_DATA_LOOKUP,
46 +        SG_ERROR_KSTAT_LOOKUP,
47 +        SG_ERROR_KSTAT_OPEN,
48 +        SG_ERROR_KSTAT_READ,
49 +        SG_ERROR_KVM_GETSWAPINFO,
50 +        SG_ERROR_KVM_OPENFILES,
51 +        SG_ERROR_MALLOC,
52 +        SG_ERROR_OPEN,
53 +        SG_ERROR_OPENDIR,
54 +        SG_ERROR_PARSE,
55 +        SG_ERROR_SETEGID,
56 +        SG_ERROR_SETEUID,
57 +        SG_ERROR_SETMNTENT,
58 +        SG_ERROR_SOCKET,
59 +        SG_ERROR_SWAPCTL,
60 +        SG_ERROR_SYSCONF,
61 +        SG_ERROR_SYSCTL,
62 +        SG_ERROR_SYSCTLBYNAME,
63 +        SG_ERROR_SYSCTLNAMETOMIB,
64 +        SG_ERROR_UNAME,
65 +        SG_ERROR_UNSUPPORTED,
66 +        SG_ERROR_XSW_VER_MISMATCH,
67 +        SG_ERROR_PSTAT
68 + } sg_error;
69 +
70 + void sg_set_error(sg_error code, const char *arg);
71 + void sg_set_error_with_errno(sg_error code, const char *arg);
72 + sg_error sg_get_error();
73 + const char *sg_get_error_arg();
74 + int sg_get_error_errno();
75 + const char *sg_str_error(sg_error code);
76 +
77   typedef struct {
78          char *os_name;
79          char *os_release;
# Line 44 | Line 86 | typedef struct {
86   sg_host_info *sg_get_host_info();
87  
88   typedef struct {
89 <        long long user;
90 <        long long kernel;
91 <        long long idle;
92 <        long long iowait;
93 <        long long swap;
94 <        long long nice;
95 <        long long total;
96 <        time_t systime;
89 >        long long user;
90 >        long long kernel;
91 >        long long idle;
92 >        long long iowait;
93 >        long long swap;
94 >        long long nice;
95 >        long long total;
96 >        time_t systime;
97   } sg_cpu_stats;
98  
99   sg_cpu_stats *sg_get_cpu_stats();
100   sg_cpu_stats *sg_get_cpu_stats_diff();
101  
102   typedef struct {
103 <        float user;
104 <        float kernel;
105 <        float idle;
106 <        float iowait;
107 <        float swap;
108 <        float nice;
103 >        float user;
104 >        float kernel;
105 >        float idle;
106 >        float iowait;
107 >        float swap;
108 >        float nice;
109          time_t time_taken;
110   } sg_cpu_percents;
111  
# Line 102 | Line 144 | typedef struct {
144   sg_swap_stats *sg_get_swap_stats();
145  
146   typedef struct {
147 <        char *device_name;
147 >        char *device_name;
148          char *fs_type;
149 <        char *mnt_point;
150 <        long long size;
151 <        long long used;
152 <        long long avail;
153 <        long long total_inodes;
149 >        char *mnt_point;
150 >        long long size;
151 >        long long used;
152 >        long long avail;
153 >        long long total_inodes;
154          long long used_inodes;
155 <        long long free_inodes;
155 >        long long free_inodes;
156 >        long long avail_inodes;
157 >        long long io_size;
158 >        long long block_size;
159 >        long long total_blocks;
160 >        long long free_blocks;
161 >        long long used_blocks;
162 >        long long avail_blocks;
163   } sg_fs_stats;
164  
165   sg_fs_stats *sg_get_fs_stats(int *entries);
166  
167 + int sg_fs_compare_device_name(const void *va, const void *vb);
168 + int sg_fs_compare_mnt_point(const void *va, const void *vb);
169 +
170   typedef struct {
171          char *disk_name;
172          long long read_bytes;
# Line 125 | Line 177 | typedef struct {
177   sg_disk_io_stats *sg_get_disk_io_stats(int *entries);
178   sg_disk_io_stats *sg_get_disk_io_stats_diff(int *entries);
179  
180 + int sg_disk_io_compare_name(const void *va, const void *vb);
181 +
182   typedef struct {
183          char *interface_name;
184          long long tx;
# Line 140 | Line 194 | typedef struct {
194   sg_network_io_stats *sg_get_network_io_stats(int *entries);
195   sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
196  
197 + int sg_network_io_compare_name(const void *va, const void *vb);
198 +
199   typedef enum {
200          SG_IFACE_DUPLEX_FULL,
201          SG_IFACE_DUPLEX_HALF,
# Line 149 | Line 205 | typedef enum {
205   typedef struct {
206          char *interface_name;
207          int speed;      /* In megabits/sec */
208 +        sg_iface_duplex duplex;
209 + #ifdef SG_ENABLE_DEPRECATED
210          sg_iface_duplex dup;
211 + #endif
212          int up;
213   } sg_network_iface_stats;
214  
215   sg_network_iface_stats *sg_get_network_iface_stats(int *entries);
216  
217 + int sg_network_iface_compare_name(const void *va, const void *vb);
218 +
219   typedef struct {
220          long long pages_pagein;
221          long long pages_pageout;
# Line 195 | Line 256 | typedef struct {
256  
257   sg_process_stats *sg_get_process_stats(int *entries);
258  
259 + int sg_process_compare_name(const void *va, const void *vb);
260 + int sg_process_compare_pid(const void *va, const void *vb);
261 + int sg_process_compare_uid(const void *va, const void *vb);
262 + int sg_process_compare_gid(const void *va, const void *vb);
263 + int sg_process_compare_size(const void *va, const void *vb);
264 + int sg_process_compare_res(const void *va, const void *vb);
265 + int sg_process_compare_cpu(const void *va, const void *vb);
266 + int sg_process_compare_time(const void *va, const void *vb);
267 +
268   typedef struct {
269          int total;
270          int running;
# Line 205 | Line 275 | typedef struct {
275  
276   sg_process_count *sg_get_process_count();
277  
278 + #ifdef SG_ENABLE_DEPRECATED
279 + #include <statgrab_deprecated.h>
280 + #endif
281 +
282 + #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines