ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.34
Committed: Tue Apr 6 14:52:58 2004 UTC (20 years, 1 month ago) by tdb
Content type: text/plain
Branch: MAIN
Changes since 1.33: +2 -2 lines
Log Message:
Update name of project at the top of all soure files. These files now exist
in their own right, rather than as part of the "CMS".

File Contents

# User Rev Content
1 tdb 1.22 /*
2 tdb 1.34 * i-scream libstatgrab
3 tdb 1.13 * http://www.i-scream.org
4 tdb 1.22 * Copyright (C) 2000-2004 i-scream
5 pajs 1.1 *
6 tdb 1.22 * 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 pajs 1.1 *
11 tdb 1.22 * This library is distributed in the hope that it will be useful,
12 pajs 1.1 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 tdb 1.22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14     * Lesser General Public License for more details.
15 pajs 1.1 *
16 tdb 1.22 * 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 tdb 1.23 *
21 tdb 1.34 * $Id: statgrab.h,v 1.33 2004/04/05 15:40:15 ats Exp $
22 pajs 1.1 */
23    
24 pajs 1.21 #include <sys/types.h>
25    
26 ats 1.33 /* 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 struct {
36     char *os_name;
37     char *os_release;
38     char *os_version;
39     char *platform;
40     char *hostname;
41     time_t uptime;
42     } sg_host_info;
43    
44     sg_host_info *sg_get_host_info();
45    
46     typedef struct {
47 pajs 1.9 long long user;
48     long long kernel;
49     long long idle;
50     long long iowait;
51     long long swap;
52     long long nice;
53     long long total;
54 pajs 1.1 time_t systime;
55 ats 1.33 } sg_cpu_stats;
56 pajs 1.1
57 ats 1.33 sg_cpu_stats *sg_get_cpu_stats();
58     sg_cpu_stats *sg_get_cpu_stats_diff();
59    
60     typedef struct {
61 pajs 1.1 float user;
62     float kernel;
63     float idle;
64     float iowait;
65     float swap;
66     float nice;
67     time_t time_taken;
68 ats 1.33 } sg_cpu_percents;
69    
70     sg_cpu_percents *sg_get_cpu_percents();
71 pajs 1.1
72 ats 1.33 typedef struct {
73 pajs 1.1 long long total;
74     long long free;
75     long long used;
76     long long cache;
77 ats 1.33 } sg_mem_stats;
78    
79     sg_mem_stats *sg_get_mem_stats();
80 pajs 1.1
81 ats 1.33 typedef struct {
82 pajs 1.1 double min1;
83     double min5;
84     double min15;
85 ats 1.33 } sg_load_stats;
86    
87     sg_load_stats *sg_get_load_stats();
88 pajs 1.1
89 ats 1.33 typedef struct {
90 pajs 1.8 char *name_list;
91 pajs 1.1 int num_entries;
92 ats 1.33 } sg_user_stats;
93    
94     sg_user_stats *sg_get_user_stats();
95 pajs 1.1
96 ats 1.33 typedef struct {
97 pajs 1.1 long long total;
98     long long used;
99     long long free;
100 ats 1.33 } sg_swap_stats;
101 pajs 1.1
102 ats 1.33 sg_swap_stats *sg_get_swap_stats();
103 pajs 1.1
104     typedef struct {
105     char *device_name;
106     char *fs_type;
107     char *mnt_point;
108     long long size;
109     long long used;
110     long long avail;
111     long long total_inodes;
112     long long used_inodes;
113     long long free_inodes;
114 ats 1.33 } sg_fs_stats;
115    
116     sg_fs_stats *sg_get_fs_stats(int *entries);
117 pajs 1.1
118 ats 1.33 typedef struct {
119 pajs 1.4 char *disk_name;
120     long long read_bytes;
121     long long write_bytes;
122     time_t systime;
123 ats 1.33 } sg_disk_io_stats;
124 pajs 1.4
125 ats 1.33 sg_disk_io_stats *sg_get_disk_io_stats(int *entries);
126     sg_disk_io_stats *sg_get_disk_io_stats_diff(int *entries);
127 pajs 1.1
128 ats 1.33 typedef struct {
129 pajs 1.1 char *interface_name;
130     long long tx;
131     long long rx;
132 tdb 1.28 long long ipackets;
133     long long opackets;
134     long long ierrors;
135     long long oerrors;
136     long long collisions;
137 pajs 1.1 time_t systime;
138 ats 1.33 } sg_network_io_stats;
139    
140     sg_network_io_stats *sg_get_network_io_stats(int *entries);
141     sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
142 pajs 1.24
143 ats 1.33 typedef enum {
144     SG_IFACE_DUPLEX_FULL,
145     SG_IFACE_DUPLEX_HALF,
146     SG_IFACE_DUPLEX_UNKNOWN
147     } sg_iface_duplex;
148 pajs 1.24
149 ats 1.33 typedef struct {
150 pajs 1.24 char *interface_name;
151     int speed; /* In megabits/sec */
152 ats 1.33 sg_iface_duplex dup;
153 pajs 1.27 int up;
154 ats 1.33 } sg_network_iface_stats;
155    
156     sg_network_iface_stats *sg_get_network_iface_stats(int *entries);
157 pajs 1.1
158 ats 1.33 typedef struct {
159 pajs 1.2 long long pages_pagein;
160     long long pages_pageout;
161 pajs 1.1 time_t systime;
162 ats 1.33 } sg_page_stats;
163    
164     sg_page_stats *sg_get_page_stats();
165     sg_page_stats *sg_get_page_stats_diff();
166 pajs 1.29
167 ats 1.33 typedef enum {
168     SG_PROCESS_STATE_RUNNING,
169     SG_PROCESS_STATE_SLEEPING,
170     SG_PROCESS_STATE_STOPPED,
171     SG_PROCESS_STATE_ZOMBIE,
172     SG_PROCESS_STATE_UNKNOWN
173     } sg_process_state;
174 pajs 1.30
175 ats 1.33 typedef struct {
176 pajs 1.29 char *process_name;
177     char *proctitle;
178    
179     pid_t pid;
180     pid_t parent; /* Parent pid */
181     pid_t pgid; /* process id of process group leader */
182    
183     uid_t uid;
184     uid_t euid;
185     gid_t gid;
186     gid_t egid;
187    
188     unsigned long long proc_size; /* in bytes */
189     unsigned long long proc_resident; /* in bytes */
190 tdb 1.31 time_t time_spent; /* time running in seconds */
191 pajs 1.29 double cpu_percent;
192     int nice;
193 ats 1.33 sg_process_state state;
194     } sg_process_stats;
195 pajs 1.29
196 ats 1.33 sg_process_stats *sg_get_process_stats(int *entries);
197 pajs 1.1
198 ats 1.33 typedef struct {
199     int total;
200     int running;
201     int sleeping;
202     int stopped;
203     int zombie;
204     } sg_process_count;
205 pajs 1.14
206 ats 1.33 sg_process_count *sg_get_process_count();
207 ats 1.18