ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.3
Committed: Wed Feb 19 00:25:36 2003 UTC (21 years, 3 months ago) by pajs
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
Added get_page_stats_diff() which returns the number of pages in/out etc since
last time it was called, and the time difference since last time it was called.
This makes it very easy for a host to know how many pages averaged over a period
of time.

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     uint_t user;
25     uint_t kernel;
26     uint_t idle;
27     uint_t iowait;
28     uint_t swap;
29     uint_t nice;
30     uint_t total;
31     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 char name[MAX_LOGIN_NAME_SIZE+1];
62    
63     typedef struct{
64     name *name_list;
65     int num_entries;
66     }user_stat_t;
67    
68     typedef struct{
69     long long total;
70     long long used;
71     long long free;
72     }swap_stat_t;
73    
74     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;
82    
83     typedef struct {
84     char *device_name;
85     char *fs_type;
86     char *mnt_point;
87     long long size;
88     long long used;
89     long long avail;
90     long long total_inodes;
91     long long used_inodes;
92     long long free_inodes;
93     }disk_stat_t;
94    
95     typedef struct{
96     int total;
97     int running;
98     int sleeping;
99     int stopped;
100     int zombie;
101     }process_stat_t;
102    
103     typedef struct{
104     char *interface_name;
105     long long tx;
106     long long rx;
107     time_t systime;
108     }network_stat_t;
109    
110     typedef struct{
111 pajs 1.2 long long num_pagein;
112     long long num_pageout;
113     long long pages_pagein;
114     long long pages_pageout;
115 pajs 1.1 time_t systime;
116     }page_stat_t;
117    
118     cpu_states_t *get_cpu_totals();
119     cpu_states_t *get_cpu_diff();
120     cpu_percent_t *cpu_percent_usage();
121    
122     mem_stat_t *get_memory_stats();
123    
124     load_stat_t *get_load_stats();
125    
126     user_stat_t *get_user_stats();
127    
128     swap_stat_t *get_swap_stats();
129    
130     general_stat_t *get_general_stats();
131    
132     disk_stat_t *get_disk_stats(int *entries);
133    
134     process_stat_t *get_process_stats();
135    
136     network_stat_t *get_network_stats(int *entries);
137 pajs 1.2
138     page_stat_t *get_page_stats();
139 pajs 1.3 page_stat_t *get_page_stats_diff();