ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.17
Committed: Tue Nov 11 10:27:04 2003 UTC (20 years, 6 months ago) by tdb
Content type: text/plain
Branch: MAIN
Changes since 1.16: +3 -4 lines
Log Message:
Fix a couple of Cygwin build issues. Not all the #ifdef LINUX's were
changed in a previous commit.

File Contents

# User Rev Content
1 pajs 1.1 /*
2     * i-scream central monitoring system
3 tdb 1.13 * http://www.i-scream.org
4     * Copyright (C) 2000-2003 i-scream
5 pajs 1.1 *
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.
10     *
11     * This program 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.
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.
19     */
20    
21     #include <sys/types.h>
22 ats 1.15 #ifdef NETBSD
23     #include <limits.h>
24     #endif
25 tdb 1.16 #ifdef CYGWIN
26     #include <sys/unistd.h>
27     #endif
28 pajs 1.1
29     typedef struct{
30 pajs 1.9 long long user;
31     long long kernel;
32     long long idle;
33     long long iowait;
34     long long swap;
35     long long nice;
36     long long total;
37 pajs 1.1 time_t systime;
38     }cpu_states_t;
39    
40     typedef struct{
41     float user;
42     float kernel;
43     float idle;
44     float iowait;
45     float swap;
46     float nice;
47     time_t time_taken;
48     }cpu_percent_t;
49    
50     typedef struct{
51     long long total;
52     long long free;
53     long long used;
54     long long cache;
55     }mem_stat_t;
56    
57     typedef struct{
58     double min1;
59     double min5;
60     double min15;
61     }load_stat_t;
62    
63     #ifdef SOLARIS
64     #define MAX_LOGIN_NAME_SIZE 8
65     #endif
66 pajs 1.12 #if defined(LINUX) || defined(FREEBSD)
67 pajs 1.10 #define MAX_LOGIN_NAME_SIZE UT_NAMESIZE
68 tdb 1.16 #endif
69 ats 1.15 #ifdef NETBSD
70     #define MAX_LOGIN_NAME_SIZE _POSIX_LOGIN_NAME_MAX
71 tdb 1.17 #endif
72     #if defined(CYGWIN)
73     #define MAX_LOGIN_NAME_SIZE _SC_LOGIN_NAME_MAX
74 pajs 1.10 #endif
75 pajs 1.1
76     typedef struct{
77 pajs 1.8 char *name_list;
78 pajs 1.1 int num_entries;
79     }user_stat_t;
80    
81     typedef struct{
82     long long total;
83     long long used;
84     long long free;
85     }swap_stat_t;
86    
87     typedef struct{
88     char *os_name;
89     char *os_release;
90     char *os_version;
91     char *platform;
92     char *hostname;
93     time_t uptime;
94     }general_stat_t;
95    
96     typedef struct {
97     char *device_name;
98     char *fs_type;
99     char *mnt_point;
100     long long size;
101     long long used;
102     long long avail;
103     long long total_inodes;
104     long long used_inodes;
105     long long free_inodes;
106     }disk_stat_t;
107    
108     typedef struct{
109 pajs 1.4 char *disk_name;
110     long long read_bytes;
111     long long write_bytes;
112     time_t systime;
113     }diskio_stat_t;
114    
115     typedef struct{
116 pajs 1.1 int total;
117     int running;
118     int sleeping;
119     int stopped;
120     int zombie;
121     }process_stat_t;
122    
123     typedef struct{
124     char *interface_name;
125     long long tx;
126     long long rx;
127     time_t systime;
128     }network_stat_t;
129    
130     typedef struct{
131 pajs 1.2 long long pages_pagein;
132     long long pages_pageout;
133 pajs 1.1 time_t systime;
134     }page_stat_t;
135    
136     cpu_states_t *get_cpu_totals();
137     cpu_states_t *get_cpu_diff();
138     cpu_percent_t *cpu_percent_usage();
139    
140     mem_stat_t *get_memory_stats();
141    
142     load_stat_t *get_load_stats();
143    
144     user_stat_t *get_user_stats();
145    
146     swap_stat_t *get_swap_stats();
147    
148     general_stat_t *get_general_stats();
149    
150     disk_stat_t *get_disk_stats(int *entries);
151 pajs 1.5 diskio_stat_t *get_diskio_stats(int *entries);
152 pajs 1.7 diskio_stat_t *get_diskio_stats_diff(int *entries);
153 pajs 1.1
154     process_stat_t *get_process_stats();
155    
156     network_stat_t *get_network_stats(int *entries);
157 pajs 1.4 network_stat_t *get_network_stats_diff(int *entries);
158 pajs 1.2
159     page_stat_t *get_page_stats();
160 pajs 1.3 page_stat_t *get_page_stats_diff();
161 pajs 1.14
162     int statgrab_init(void);