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.19 by pajs, Tue Jan 6 22:28:41 2004 UTC vs.
Revision 1.37 by ats, Tue Apr 6 22:09:22 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines