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.3 by pajs, Wed Feb 19 00:25:36 2003 UTC vs.
Revision 1.39 by tdb, Wed Apr 7 14:45:40 2004 UTC

# Line 1 | Line 1
1 < /*
2 < * i-scream central monitoring system
3 < * http://www.i-scream.org.uk
4 < * Copyright (C) 2000-2002 i-scream
1 > /*
2 > * i-scream libstatgrab
3 > * http://www.i-scream.org
4 > * Copyright (C) 2000-2004 i-scream
5   *
6 < * This program is free software; you can redistribute it and/or
7 < * modify it under the terms of the GNU General Public License
8 < * as published by the Free Software Foundation; either version 2
9 < * of the License, or (at your option) any later version.
6 > * This library is free software; you can redistribute it and/or
7 > * modify it under the terms of the GNU Lesser General Public
8 > * License as published by the Free Software Foundation; either
9 > * version 2.1 of the License, or (at your option) any later version.
10   *
11 < * This program is distributed in the hope that it will be useful,
11 > * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 < * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 < * GNU General Public License for more details.
13 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 > * Lesser General Public License for more details.
15   *
16 < * You should have received a copy of the GNU General Public License
17 < * along with this program; if not, write to the Free Software
18 < * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 > * You should have received a copy of the GNU Lesser General Public
17 > * License along with this library; if not, write to the Free Software
18 > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 > * 02111-1307 USA
20 > *
21 > * $Id$
22   */
23  
24   #include <sys/types.h>
25  
26 < typedef struct{
27 <        uint_t user;
28 <        uint_t kernel;
29 <        uint_t idle;
30 <        uint_t iowait;
28 <        uint_t swap;
29 <        uint_t nice;
30 <        uint_t total;
31 <        time_t systime;
32 < }cpu_states_t;
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 < typedef struct{
33 <        float user;
34 <        float kernel;
35 <        float idle;
36 <        float iowait;
37 <        float swap;
38 <        float nice;
32 > int sg_init(void);
33 > int sg_drop_privileges(void);
34 >
35 > typedef enum {
36 >        SG_ERROR_NONE = 0,
37 >        SG_ERROR_MALLOC,
38 >        SG_ERROR_KSTAT_OPEN,
39 >        SG_ERROR_OPEN,
40 >        SG_ERROR_SYSCTLBYNAME,
41 >        SG_ERROR_PARSE
42 > } sg_error;
43 >
44 > void sg_set_error(sg_error code, const char *arg);
45 > sg_error sg_get_error();
46 > const char *sg_str_error(sg_error code);
47 >
48 > typedef struct {
49 >        char *os_name;
50 >        char *os_release;
51 >        char *os_version;
52 >        char *platform;
53 >        char *hostname;
54 >        time_t uptime;
55 > } sg_host_info;
56 >
57 > sg_host_info *sg_get_host_info();
58 >
59 > typedef struct {
60 >        long long user;
61 >        long long kernel;
62 >        long long idle;
63 >        long long iowait;
64 >        long long swap;
65 >        long long nice;
66 >        long long total;
67 >        time_t systime;
68 > } sg_cpu_stats;
69 >
70 > sg_cpu_stats *sg_get_cpu_stats();
71 > sg_cpu_stats *sg_get_cpu_stats_diff();
72 >
73 > typedef struct {
74 >        float user;
75 >        float kernel;
76 >        float idle;
77 >        float iowait;
78 >        float swap;
79 >        float nice;
80          time_t time_taken;
81 < }cpu_percent_t;
81 > } sg_cpu_percents;
82  
83 < typedef struct{
83 > sg_cpu_percents *sg_get_cpu_percents();
84 >
85 > typedef struct {
86          long long total;
87          long long free;
88          long long used;
89          long long cache;
90 < }mem_stat_t;
90 > } sg_mem_stats;
91  
92 < typedef struct{
92 > sg_mem_stats *sg_get_mem_stats();
93 >
94 > typedef struct {
95          double min1;
96          double min5;
97          double min15;
98 < }load_stat_t;
98 > } sg_load_stats;
99  
100 < #ifdef SOLARIS
58 < #define MAX_LOGIN_NAME_SIZE 8
59 < #endif
100 > sg_load_stats *sg_get_load_stats();
101  
102 < typedef char name[MAX_LOGIN_NAME_SIZE+1];
103 <
63 < typedef struct{
64 <        name *name_list;
102 > typedef struct {
103 >        char *name_list;
104          int num_entries;
105 < }user_stat_t;
105 > } sg_user_stats;
106  
107 < typedef struct{
107 > sg_user_stats *sg_get_user_stats();
108 >
109 > typedef struct {
110          long long total;
111          long long used;
112          long long free;
113 < }swap_stat_t;
113 > } sg_swap_stats;
114  
115 < typedef struct{
75 <        char *os_name;
76 <        char *os_release;
77 <        char *os_version;
78 <        char *platform;
79 <        char *hostname;
80 <        time_t uptime;
81 < }general_stat_t;
115 > sg_swap_stats *sg_get_swap_stats();
116  
117   typedef struct {
118 <        char *device_name;
118 >        char *device_name;
119          char *fs_type;
120 <        char *mnt_point;
121 <        long long size;
122 <        long long used;
123 <        long long avail;
124 <        long long total_inodes;
120 >        char *mnt_point;
121 >        long long size;
122 >        long long used;
123 >        long long avail;
124 >        long long total_inodes;
125          long long used_inodes;
126 <        long long free_inodes;
127 < }disk_stat_t;
126 >        long long free_inodes;
127 > } sg_fs_stats;
128  
129 < typedef struct{
96 <        int total;
97 <        int running;
98 <        int sleeping;
99 <        int stopped;
100 <        int zombie;
101 < }process_stat_t;
129 > sg_fs_stats *sg_get_fs_stats(int *entries);
130  
131 < typedef struct{
131 > typedef struct {
132 >        char *disk_name;
133 >        long long read_bytes;
134 >        long long write_bytes;
135 >        time_t systime;
136 > } sg_disk_io_stats;
137 >
138 > sg_disk_io_stats *sg_get_disk_io_stats(int *entries);
139 > sg_disk_io_stats *sg_get_disk_io_stats_diff(int *entries);
140 >
141 > typedef struct {
142          char *interface_name;
143          long long tx;
144          long long rx;
145 +        long long ipackets;
146 +        long long opackets;
147 +        long long ierrors;
148 +        long long oerrors;
149 +        long long collisions;
150          time_t systime;
151 < }network_stat_t;
151 > } sg_network_io_stats;
152  
153 < typedef struct{
154 <        long long num_pagein;
155 <        long long num_pageout;
153 > sg_network_io_stats *sg_get_network_io_stats(int *entries);
154 > sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
155 >
156 > typedef enum {
157 >        SG_IFACE_DUPLEX_FULL,
158 >        SG_IFACE_DUPLEX_HALF,
159 >        SG_IFACE_DUPLEX_UNKNOWN
160 > } sg_iface_duplex;
161 >
162 > typedef struct {
163 >        char *interface_name;
164 >        int speed;      /* In megabits/sec */
165 >        sg_iface_duplex dup;
166 >        int up;
167 > } sg_network_iface_stats;
168 >
169 > sg_network_iface_stats *sg_get_network_iface_stats(int *entries);
170 >
171 > typedef struct {
172          long long pages_pagein;
173          long long pages_pageout;
174          time_t systime;
175 < }page_stat_t;
175 > } sg_page_stats;
176  
177 < cpu_states_t *get_cpu_totals();
178 < cpu_states_t *get_cpu_diff();
120 < cpu_percent_t *cpu_percent_usage();
177 > sg_page_stats *sg_get_page_stats();
178 > sg_page_stats *sg_get_page_stats_diff();
179  
180 < mem_stat_t *get_memory_stats();
180 > typedef enum {
181 >        SG_PROCESS_STATE_RUNNING,
182 >        SG_PROCESS_STATE_SLEEPING,
183 >        SG_PROCESS_STATE_STOPPED,
184 >        SG_PROCESS_STATE_ZOMBIE,
185 >        SG_PROCESS_STATE_UNKNOWN
186 > } sg_process_state;
187  
188 < load_stat_t *get_load_stats();
188 > typedef struct {
189 >        char *process_name;
190 >        char *proctitle;
191  
192 < user_stat_t *get_user_stats();
192 >        pid_t pid;
193 >        pid_t parent; /* Parent pid */
194 >        pid_t pgid;   /* process id of process group leader */
195  
196 < swap_stat_t *get_swap_stats();
196 >        uid_t uid;
197 >        uid_t euid;
198 >        gid_t gid;
199 >        gid_t egid;
200  
201 < general_stat_t *get_general_stats();
201 >        unsigned long long proc_size; /* in bytes */
202 >        unsigned long long proc_resident; /* in bytes */
203 >        time_t time_spent; /* time running in seconds */
204 >        double cpu_percent;
205 >        int nice;
206 >        sg_process_state state;
207 > } sg_process_stats;
208  
209 < disk_stat_t *get_disk_stats(int *entries);
209 > sg_process_stats *sg_get_process_stats(int *entries);
210  
211 < process_stat_t *get_process_stats();
211 > typedef struct {
212 >        int total;
213 >        int running;
214 >        int sleeping;
215 >        int stopped;
216 >        int zombie;
217 > } sg_process_count;
218  
219 < network_stat_t *get_network_stats(int *entries);
219 > sg_process_count *sg_get_process_count();
220  
221 < page_stat_t *get_page_stats();
222 < page_stat_t *get_page_stats_diff();
221 > #ifdef SG_ENABLE_DEPRECATED
222 > #include <statgrab_deprecated.h>
223 > #endif
224 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines