ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision: 1.22
Committed: Fri Jan 16 15:54:54 2004 UTC (20 years, 4 months ago) by tdb
Content type: text/plain
Branch: MAIN
Changes since 1.21: +13 -12 lines
Log Message:
Alter the licensing of libstatgrab. The library part is now under the
LGPL, whilst the tools/examples are under the GPL. Both licenses are
included in the distribution (and are both now in CVS). Also made a
minor alteration to the webpage where it said everything was licensed
under the GPL.

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * http://www.i-scream.org
4 * Copyright (C) 2000-2004 i-scream
5 *
6 * 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 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * 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 */
21
22 #include <sys/types.h>
23
24 typedef struct{
25 long long user;
26 long long kernel;
27 long long idle;
28 long long iowait;
29 long long swap;
30 long long nice;
31 long long total;
32 time_t systime;
33 }cpu_states_t;
34
35 typedef struct{
36 float user;
37 float kernel;
38 float idle;
39 float iowait;
40 float swap;
41 float nice;
42 time_t time_taken;
43 }cpu_percent_t;
44
45 typedef struct{
46 long long total;
47 long long free;
48 long long used;
49 long long cache;
50 }mem_stat_t;
51
52 typedef struct{
53 double min1;
54 double min5;
55 double min15;
56 }load_stat_t;
57
58 typedef struct{
59 char *name_list;
60 int num_entries;
61 }user_stat_t;
62
63 typedef struct{
64 long long total;
65 long long used;
66 long long free;
67 }swap_stat_t;
68
69 typedef struct{
70 char *os_name;
71 char *os_release;
72 char *os_version;
73 char *platform;
74 char *hostname;
75 time_t uptime;
76 }general_stat_t;
77
78 typedef struct {
79 char *device_name;
80 char *fs_type;
81 char *mnt_point;
82 long long size;
83 long long used;
84 long long avail;
85 long long total_inodes;
86 long long used_inodes;
87 long long free_inodes;
88 }disk_stat_t;
89
90 typedef struct{
91 char *disk_name;
92 long long read_bytes;
93 long long write_bytes;
94 time_t systime;
95 }diskio_stat_t;
96
97 typedef struct{
98 int total;
99 int running;
100 int sleeping;
101 int stopped;
102 int zombie;
103 }process_stat_t;
104
105 typedef struct{
106 char *interface_name;
107 long long tx;
108 long long rx;
109 time_t systime;
110 }network_stat_t;
111
112 typedef struct{
113 long long pages_pagein;
114 long long pages_pageout;
115 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 diskio_stat_t *get_diskio_stats(int *entries);
134 diskio_stat_t *get_diskio_stats_diff(int *entries);
135
136 process_stat_t *get_process_stats();
137
138 network_stat_t *get_network_stats(int *entries);
139 network_stat_t *get_network_stats_diff(int *entries);
140
141 page_stat_t *get_page_stats();
142 page_stat_t *get_page_stats_diff();
143
144 int statgrab_init(void);
145 int statgrab_drop_privileges(void);
146