ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.9
Committed: Mon Mar 3 13:14:25 2003 UTC (21 years, 2 months ago) by pajs
Content type: text/plain
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_2
Changes since 1.8: +7 -7 lines
Log Message:
Made cpu stats to a type a bit more cross platform :)

File Contents

# User Rev Content
1 pajs 1.1 /*
2     * i-scream central monitoring system
3     * http://www.i-scream.org.uk
4     * Copyright (C) 2000-2002 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.
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    
23     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     #ifdef SOLARIS
58     #define MAX_LOGIN_NAME_SIZE 8
59     #endif
60    
61     typedef struct{
62 pajs 1.8 char *name_list;
63 pajs 1.1 int num_entries;
64     }user_stat_t;
65    
66     typedef struct{
67     long long total;
68     long long used;
69     long long free;
70     }swap_stat_t;
71    
72     typedef struct{
73     char *os_name;
74     char *os_release;
75     char *os_version;
76     char *platform;
77     char *hostname;
78     time_t uptime;
79     }general_stat_t;
80    
81     typedef struct {
82     char *device_name;
83     char *fs_type;
84     char *mnt_point;
85     long long size;
86     long long used;
87     long long avail;
88     long long total_inodes;
89     long long used_inodes;
90     long long free_inodes;
91     }disk_stat_t;
92    
93     typedef struct{
94 pajs 1.4 char *disk_name;
95     long long read_bytes;
96     long long write_bytes;
97     time_t systime;
98     }diskio_stat_t;
99    
100     typedef struct{
101 pajs 1.1 int total;
102     int running;
103     int sleeping;
104     int stopped;
105     int zombie;
106     }process_stat_t;
107    
108     typedef struct{
109     char *interface_name;
110     long long tx;
111     long long rx;
112     time_t systime;
113     }network_stat_t;
114    
115     typedef struct{
116 pajs 1.2 long long num_pagein;
117     long long num_pageout;
118     long long pages_pagein;
119     long long pages_pageout;
120 pajs 1.1 time_t systime;
121     }page_stat_t;
122    
123     cpu_states_t *get_cpu_totals();
124     cpu_states_t *get_cpu_diff();
125     cpu_percent_t *cpu_percent_usage();
126    
127     mem_stat_t *get_memory_stats();
128    
129     load_stat_t *get_load_stats();
130    
131     user_stat_t *get_user_stats();
132    
133     swap_stat_t *get_swap_stats();
134    
135     general_stat_t *get_general_stats();
136    
137     disk_stat_t *get_disk_stats(int *entries);
138 pajs 1.5 diskio_stat_t *get_diskio_stats(int *entries);
139 pajs 1.7 diskio_stat_t *get_diskio_stats_diff(int *entries);
140 pajs 1.1
141     process_stat_t *get_process_stats();
142    
143     network_stat_t *get_network_stats(int *entries);
144 pajs 1.4 network_stat_t *get_network_stats_diff(int *entries);
145 pajs 1.2
146     page_stat_t *get_page_stats();
147 pajs 1.3 page_stat_t *get_page_stats_diff();