ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.21
Committed: Fri Jan 9 22:06:47 2004 UTC (20 years, 4 months ago) by pajs
Content type: text/plain
Branch: MAIN
Changes since 1.20: +2 -0 lines
Log Message:
As pointed out by azz.... time_t will be needed, thus the #include of
sys/types.h

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 pajs 1.21 #include <sys/types.h>
22    
23 pajs 1.1 typedef struct{
24 pajs 1.9 long long user;
25     long long kernel;
26     long long idle;
27     long long iowait;
28     long long swap;
29     long long nice;
30     long long total;
31 pajs 1.1 time_t systime;
32     }cpu_states_t;
33    
34     typedef struct{
35     float user;
36     float kernel;
37     float idle;
38     float iowait;
39     float swap;
40     float nice;
41     time_t time_taken;
42     }cpu_percent_t;
43    
44     typedef struct{
45     long long total;
46     long long free;
47     long long used;
48     long long cache;
49     }mem_stat_t;
50    
51     typedef struct{
52     double min1;
53     double min5;
54     double min15;
55     }load_stat_t;
56    
57     typedef struct{
58 pajs 1.8 char *name_list;
59 pajs 1.1 int num_entries;
60     }user_stat_t;
61    
62     typedef struct{
63     long long total;
64     long long used;
65     long long free;
66     }swap_stat_t;
67    
68     typedef struct{
69     char *os_name;
70     char *os_release;
71     char *os_version;
72     char *platform;
73     char *hostname;
74     time_t uptime;
75     }general_stat_t;
76    
77     typedef struct {
78     char *device_name;
79     char *fs_type;
80     char *mnt_point;
81     long long size;
82     long long used;
83     long long avail;
84     long long total_inodes;
85     long long used_inodes;
86     long long free_inodes;
87     }disk_stat_t;
88    
89     typedef struct{
90 pajs 1.4 char *disk_name;
91     long long read_bytes;
92     long long write_bytes;
93     time_t systime;
94     }diskio_stat_t;
95    
96     typedef struct{
97 pajs 1.1 int total;
98     int running;
99     int sleeping;
100     int stopped;
101     int zombie;
102     }process_stat_t;
103    
104     typedef struct{
105     char *interface_name;
106     long long tx;
107     long long rx;
108     time_t systime;
109     }network_stat_t;
110    
111     typedef struct{
112 pajs 1.2 long long pages_pagein;
113     long long pages_pageout;
114 pajs 1.1 time_t systime;
115     }page_stat_t;
116    
117     cpu_states_t *get_cpu_totals();
118     cpu_states_t *get_cpu_diff();
119     cpu_percent_t *cpu_percent_usage();
120    
121     mem_stat_t *get_memory_stats();
122    
123     load_stat_t *get_load_stats();
124    
125     user_stat_t *get_user_stats();
126    
127     swap_stat_t *get_swap_stats();
128    
129     general_stat_t *get_general_stats();
130    
131     disk_stat_t *get_disk_stats(int *entries);
132 pajs 1.5 diskio_stat_t *get_diskio_stats(int *entries);
133 pajs 1.7 diskio_stat_t *get_diskio_stats_diff(int *entries);
134 pajs 1.1
135     process_stat_t *get_process_stats();
136    
137     network_stat_t *get_network_stats(int *entries);
138 pajs 1.4 network_stat_t *get_network_stats_diff(int *entries);
139 pajs 1.2
140     page_stat_t *get_page_stats();
141 pajs 1.3 page_stat_t *get_page_stats_diff();
142 pajs 1.14
143     int statgrab_init(void);
144 ats 1.18 int statgrab_drop_privileges(void);
145