perfmonger 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.dir-locals.el +2 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.travis.yml +12 -0
- data/COPYING +674 -0
- data/Gemfile +5 -0
- data/HOWTO.md +15 -0
- data/NEWS +115 -0
- data/README.md +61 -0
- data/Rakefile +8 -0
- data/bin/perfmonger +6 -0
- data/data/NOTICE +8 -0
- data/data/Twitter_Bootstrap_LICENSE.txt +176 -0
- data/data/assets/css/bootstrap-responsive.css +1109 -0
- data/data/assets/css/bootstrap.css +6167 -0
- data/data/assets/css/perfmonger.css +17 -0
- data/data/assets/dashboard.erb +319 -0
- data/data/assets/img/glyphicons-halflings-white.png +0 -0
- data/data/assets/img/glyphicons-halflings.png +0 -0
- data/data/assets/js/bootstrap.js +2280 -0
- data/data/assets/js/bootstrap.min.js +6 -0
- data/data/assets/js/canvasjs.js +9042 -0
- data/data/assets/js/canvasjs.min.js +271 -0
- data/data/sysstat.ioconf +268 -0
- data/ext/perfmonger/extconf.rb +19 -0
- data/ext/perfmonger/perfmonger.h +58 -0
- data/ext/perfmonger/perfmonger_record.c +754 -0
- data/ext/perfmonger/sysstat/common.c +627 -0
- data/ext/perfmonger/sysstat/common.h +207 -0
- data/ext/perfmonger/sysstat/ioconf.c +515 -0
- data/ext/perfmonger/sysstat/ioconf.h +84 -0
- data/ext/perfmonger/sysstat/iostat.c +1100 -0
- data/ext/perfmonger/sysstat/iostat.h +121 -0
- data/ext/perfmonger/sysstat/libsysstat.h +19 -0
- data/ext/perfmonger/sysstat/mpstat.c +953 -0
- data/ext/perfmonger/sysstat/mpstat.h +79 -0
- data/ext/perfmonger/sysstat/rd_stats.c +2388 -0
- data/ext/perfmonger/sysstat/rd_stats.h +651 -0
- data/ext/perfmonger/sysstat/sysconfig.h +13 -0
- data/lib/perfmonger/cli.rb +115 -0
- data/lib/perfmonger/command/base_command.rb +39 -0
- data/lib/perfmonger/command/fingerprint.rb +453 -0
- data/lib/perfmonger/command/plot.rb +429 -0
- data/lib/perfmonger/command/record.rb +32 -0
- data/lib/perfmonger/command/record_option.rb +149 -0
- data/lib/perfmonger/command/server.rb +294 -0
- data/lib/perfmonger/command/stat.rb +60 -0
- data/lib/perfmonger/command/stat_option.rb +29 -0
- data/lib/perfmonger/command/summary.rb +402 -0
- data/lib/perfmonger/config.rb +6 -0
- data/lib/perfmonger/version.rb +5 -0
- data/lib/perfmonger.rb +12 -0
- data/misc/release-howto.txt +17 -0
- data/misc/sample-cpu.png +0 -0
- data/misc/sample-read-iops.png +0 -0
- data/perfmonger.gemspec +44 -0
- data/test/run-test.sh +39 -0
- data/test/spec/bin_spec.rb +37 -0
- data/test/spec/data/2devices.expected +42 -0
- data/test/spec/data/2devices.output +42 -0
- data/test/spec/spec_helper.rb +20 -0
- data/test/spec/summary_spec.rb +193 -0
- data/test/test-perfmonger.c +145 -0
- data/test/test.h +9 -0
- metadata +154 -0
@@ -0,0 +1,651 @@
|
|
1
|
+
/*
|
2
|
+
* rd_stats.h: Include file used to read system statistics
|
3
|
+
* (C) 1999-2010 by Sebastien Godard (sysstat <at> orange.fr)
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef _RD_STATS_H
|
7
|
+
#define _RD_STATS_H
|
8
|
+
|
9
|
+
#include "common.h"
|
10
|
+
|
11
|
+
|
12
|
+
/*
|
13
|
+
***************************************************************************
|
14
|
+
* Miscellaneous constants
|
15
|
+
***************************************************************************
|
16
|
+
*/
|
17
|
+
|
18
|
+
/* Get IFNAMSIZ */
|
19
|
+
#include <net/if.h>
|
20
|
+
#ifndef IFNAMSIZ
|
21
|
+
#define IFNAMSIZ 16
|
22
|
+
#endif
|
23
|
+
|
24
|
+
/* Maximum length of network interface name */
|
25
|
+
#define MAX_IFACE_LEN IFNAMSIZ
|
26
|
+
|
27
|
+
#define CNT_DEV 0
|
28
|
+
#define CNT_PART 1
|
29
|
+
#define CNT_ALL_DEV 0
|
30
|
+
#define CNT_USED_DEV 1
|
31
|
+
|
32
|
+
#define READ_PROC_STAT 0
|
33
|
+
#define READ_DISKSTATS 1
|
34
|
+
#define READ_PPARTITIONS 2
|
35
|
+
|
36
|
+
/*
|
37
|
+
***************************************************************************
|
38
|
+
* System files containing statistics
|
39
|
+
***************************************************************************
|
40
|
+
*/
|
41
|
+
|
42
|
+
/* Files */
|
43
|
+
#define PROC "/proc"
|
44
|
+
#define SERIAL "/proc/tty/driver/serial"
|
45
|
+
#define FDENTRY_STATE "/proc/sys/fs/dentry-state"
|
46
|
+
#define FFILE_NR "/proc/sys/fs/file-nr"
|
47
|
+
#define FINODE_STATE "/proc/sys/fs/inode-state"
|
48
|
+
#define PTY_NR "/proc/sys/kernel/pty/nr"
|
49
|
+
#define NET_DEV "/proc/net/dev"
|
50
|
+
#define NET_SOCKSTAT "/proc/net/sockstat"
|
51
|
+
#define NET_SOCKSTAT6 "/proc/net/sockstat6"
|
52
|
+
#define NET_RPC_NFS "/proc/net/rpc/nfs"
|
53
|
+
#define NET_RPC_NFSD "/proc/net/rpc/nfsd"
|
54
|
+
#define LOADAVG "/proc/loadavg"
|
55
|
+
#define VMSTAT "/proc/vmstat"
|
56
|
+
#define NET_SNMP "/proc/net/snmp"
|
57
|
+
#define NET_SNMP6 "/proc/net/snmp6"
|
58
|
+
#define CPUINFO "/proc/cpuinfo"
|
59
|
+
|
60
|
+
|
61
|
+
/*
|
62
|
+
***************************************************************************
|
63
|
+
* Definitions of structures for system statistics
|
64
|
+
***************************************************************************
|
65
|
+
*/
|
66
|
+
|
67
|
+
/*
|
68
|
+
* Structure for CPU statistics.
|
69
|
+
* In activity buffer: First structure is for global CPU utilisation ("all").
|
70
|
+
* Following structures are for each individual CPU (0, 1, etc.)
|
71
|
+
*/
|
72
|
+
struct stats_cpu {
|
73
|
+
unsigned long long cpu_user __attribute__ ((aligned (16)));
|
74
|
+
unsigned long long cpu_nice __attribute__ ((aligned (16)));
|
75
|
+
unsigned long long cpu_sys __attribute__ ((aligned (16)));
|
76
|
+
unsigned long long cpu_idle __attribute__ ((aligned (16)));
|
77
|
+
unsigned long long cpu_iowait __attribute__ ((aligned (16)));
|
78
|
+
unsigned long long cpu_steal __attribute__ ((aligned (16)));
|
79
|
+
unsigned long long cpu_hardirq __attribute__ ((aligned (16)));
|
80
|
+
unsigned long long cpu_softirq __attribute__ ((aligned (16)));
|
81
|
+
unsigned long long cpu_guest __attribute__ ((aligned (16)));
|
82
|
+
};
|
83
|
+
|
84
|
+
#define STATS_CPU_SIZE (sizeof(struct stats_cpu))
|
85
|
+
|
86
|
+
/*
|
87
|
+
* Structure for task creation and context switch statistics.
|
88
|
+
* The attribute (aligned(16)) is necessary so that sizeof(structure) has
|
89
|
+
* the same value on 32 and 64-bit architectures.
|
90
|
+
*/
|
91
|
+
struct stats_pcsw {
|
92
|
+
unsigned long long context_switch __attribute__ ((aligned (16)));
|
93
|
+
unsigned long processes __attribute__ ((aligned (16)));
|
94
|
+
};
|
95
|
+
|
96
|
+
#define STATS_PCSW_SIZE (sizeof(struct stats_pcsw))
|
97
|
+
|
98
|
+
/*
|
99
|
+
* Structure for interrupts statistics.
|
100
|
+
* In activity buffer: First structure is for total number of interrupts ("SUM").
|
101
|
+
* Following structures are for each individual interrupt (0, 1, etc.)
|
102
|
+
*
|
103
|
+
* NOTE: The total number of interrupts is saved as a %llu by the kernel,
|
104
|
+
* whereas individual interrupts are saved as %u.
|
105
|
+
*/
|
106
|
+
struct stats_irq {
|
107
|
+
unsigned long long irq_nr __attribute__ ((aligned (16)));
|
108
|
+
};
|
109
|
+
|
110
|
+
#define STATS_IRQ_SIZE (sizeof(struct stats_irq))
|
111
|
+
|
112
|
+
/* Structure for swapping statistics */
|
113
|
+
struct stats_swap {
|
114
|
+
unsigned long pswpin __attribute__ ((aligned (8)));
|
115
|
+
unsigned long pswpout __attribute__ ((aligned (8)));
|
116
|
+
};
|
117
|
+
|
118
|
+
#define STATS_SWAP_SIZE (sizeof(struct stats_swap))
|
119
|
+
|
120
|
+
/* Structure for paging statistics */
|
121
|
+
struct stats_paging {
|
122
|
+
unsigned long pgpgin __attribute__ ((aligned (8)));
|
123
|
+
unsigned long pgpgout __attribute__ ((aligned (8)));
|
124
|
+
unsigned long pgfault __attribute__ ((aligned (8)));
|
125
|
+
unsigned long pgmajfault __attribute__ ((aligned (8)));
|
126
|
+
unsigned long pgfree __attribute__ ((aligned (8)));
|
127
|
+
unsigned long pgscan_kswapd __attribute__ ((aligned (8)));
|
128
|
+
unsigned long pgscan_direct __attribute__ ((aligned (8)));
|
129
|
+
unsigned long pgsteal __attribute__ ((aligned (8)));
|
130
|
+
};
|
131
|
+
|
132
|
+
#define STATS_PAGING_SIZE (sizeof(struct stats_paging))
|
133
|
+
|
134
|
+
/* Structure for I/O and transfer rate statistics */
|
135
|
+
struct stats_io {
|
136
|
+
unsigned int dk_drive __attribute__ ((aligned (4)));
|
137
|
+
unsigned int dk_drive_rio __attribute__ ((packed));
|
138
|
+
unsigned int dk_drive_wio __attribute__ ((packed));
|
139
|
+
unsigned int dk_drive_rblk __attribute__ ((packed));
|
140
|
+
unsigned int dk_drive_wblk __attribute__ ((packed));
|
141
|
+
};
|
142
|
+
|
143
|
+
#define STATS_IO_SIZE (sizeof(struct stats_io))
|
144
|
+
|
145
|
+
/* Structure for memory and swap space utilization statistics */
|
146
|
+
struct stats_memory {
|
147
|
+
unsigned long frmkb __attribute__ ((aligned (8)));
|
148
|
+
unsigned long bufkb __attribute__ ((aligned (8)));
|
149
|
+
unsigned long camkb __attribute__ ((aligned (8)));
|
150
|
+
unsigned long tlmkb __attribute__ ((aligned (8)));
|
151
|
+
unsigned long frskb __attribute__ ((aligned (8)));
|
152
|
+
unsigned long tlskb __attribute__ ((aligned (8)));
|
153
|
+
unsigned long caskb __attribute__ ((aligned (8)));
|
154
|
+
unsigned long comkb __attribute__ ((aligned (8)));
|
155
|
+
unsigned long activekb __attribute__ ((aligned (8)));
|
156
|
+
unsigned long inactkb __attribute__ ((aligned (8)));
|
157
|
+
};
|
158
|
+
|
159
|
+
#define STATS_MEMORY_SIZE (sizeof(struct stats_memory))
|
160
|
+
|
161
|
+
/* Structure for kernel tables statistics */
|
162
|
+
struct stats_ktables {
|
163
|
+
unsigned int file_used __attribute__ ((aligned (4)));
|
164
|
+
unsigned int inode_used __attribute__ ((packed));
|
165
|
+
unsigned int dentry_stat __attribute__ ((packed));
|
166
|
+
unsigned int pty_nr __attribute__ ((packed));
|
167
|
+
};
|
168
|
+
|
169
|
+
#define STATS_KTABLES_SIZE (sizeof(struct stats_ktables))
|
170
|
+
|
171
|
+
/* Structure for queue and load statistics */
|
172
|
+
struct stats_queue {
|
173
|
+
unsigned long nr_running __attribute__ ((aligned (8)));
|
174
|
+
unsigned long procs_blocked __attribute__ ((aligned (8)));
|
175
|
+
unsigned int load_avg_1 __attribute__ ((aligned (8)));
|
176
|
+
unsigned int load_avg_5 __attribute__ ((packed));
|
177
|
+
unsigned int load_avg_15 __attribute__ ((packed));
|
178
|
+
unsigned int nr_threads __attribute__ ((packed));
|
179
|
+
};
|
180
|
+
|
181
|
+
#define STATS_QUEUE_SIZE (sizeof(struct stats_queue))
|
182
|
+
|
183
|
+
/* Structure for serial statistics */
|
184
|
+
struct stats_serial {
|
185
|
+
unsigned int rx __attribute__ ((aligned (4)));
|
186
|
+
unsigned int tx __attribute__ ((packed));
|
187
|
+
unsigned int frame __attribute__ ((packed));
|
188
|
+
unsigned int parity __attribute__ ((packed));
|
189
|
+
unsigned int brk __attribute__ ((packed));
|
190
|
+
unsigned int overrun __attribute__ ((packed));
|
191
|
+
/*
|
192
|
+
* A value of 0 means that the structure is unused.
|
193
|
+
* To avoid the confusion, the line number is saved as (line# + 1)
|
194
|
+
*/
|
195
|
+
unsigned int line __attribute__ ((packed));
|
196
|
+
};
|
197
|
+
|
198
|
+
#define STATS_SERIAL_SIZE (sizeof(struct stats_serial))
|
199
|
+
|
200
|
+
/* Structure for block devices statistics */
|
201
|
+
struct stats_disk {
|
202
|
+
unsigned long long rd_sect __attribute__ ((aligned (16)));
|
203
|
+
unsigned long long wr_sect __attribute__ ((aligned (16)));
|
204
|
+
unsigned long rd_ticks __attribute__ ((aligned (16)));
|
205
|
+
unsigned long wr_ticks __attribute__ ((aligned (8)));
|
206
|
+
unsigned long tot_ticks __attribute__ ((aligned (8)));
|
207
|
+
unsigned long rq_ticks __attribute__ ((aligned (8)));
|
208
|
+
unsigned long nr_ios __attribute__ ((aligned (8)));
|
209
|
+
unsigned int major __attribute__ ((aligned (8)));
|
210
|
+
unsigned int minor __attribute__ ((packed));
|
211
|
+
};
|
212
|
+
|
213
|
+
#define STATS_DISK_SIZE (sizeof(struct stats_disk))
|
214
|
+
|
215
|
+
/* Structure for network interfaces statistics */
|
216
|
+
struct stats_net_dev {
|
217
|
+
unsigned long rx_packets __attribute__ ((aligned (8)));
|
218
|
+
unsigned long tx_packets __attribute__ ((aligned (8)));
|
219
|
+
unsigned long rx_bytes __attribute__ ((aligned (8)));
|
220
|
+
unsigned long tx_bytes __attribute__ ((aligned (8)));
|
221
|
+
unsigned long rx_compressed __attribute__ ((aligned (8)));
|
222
|
+
unsigned long tx_compressed __attribute__ ((aligned (8)));
|
223
|
+
unsigned long multicast __attribute__ ((aligned (8)));
|
224
|
+
char interface[MAX_IFACE_LEN] __attribute__ ((aligned (8)));
|
225
|
+
};
|
226
|
+
|
227
|
+
#define STATS_NET_DEV_SIZE (sizeof(struct stats_net_dev))
|
228
|
+
|
229
|
+
/* Structure for network interface errors statistics */
|
230
|
+
struct stats_net_edev {
|
231
|
+
unsigned long collisions __attribute__ ((aligned (8)));
|
232
|
+
unsigned long rx_errors __attribute__ ((aligned (8)));
|
233
|
+
unsigned long tx_errors __attribute__ ((aligned (8)));
|
234
|
+
unsigned long rx_dropped __attribute__ ((aligned (8)));
|
235
|
+
unsigned long tx_dropped __attribute__ ((aligned (8)));
|
236
|
+
unsigned long rx_fifo_errors __attribute__ ((aligned (8)));
|
237
|
+
unsigned long tx_fifo_errors __attribute__ ((aligned (8)));
|
238
|
+
unsigned long rx_frame_errors __attribute__ ((aligned (8)));
|
239
|
+
unsigned long tx_carrier_errors __attribute__ ((aligned (8)));
|
240
|
+
char interface[MAX_IFACE_LEN] __attribute__ ((aligned (8)));
|
241
|
+
};
|
242
|
+
|
243
|
+
#define STATS_NET_EDEV_SIZE (sizeof(struct stats_net_edev))
|
244
|
+
|
245
|
+
/* Structure for NFS client statistics */
|
246
|
+
struct stats_net_nfs {
|
247
|
+
unsigned int nfs_rpccnt __attribute__ ((aligned (4)));
|
248
|
+
unsigned int nfs_rpcretrans __attribute__ ((packed));
|
249
|
+
unsigned int nfs_readcnt __attribute__ ((packed));
|
250
|
+
unsigned int nfs_writecnt __attribute__ ((packed));
|
251
|
+
unsigned int nfs_accesscnt __attribute__ ((packed));
|
252
|
+
unsigned int nfs_getattcnt __attribute__ ((packed));
|
253
|
+
};
|
254
|
+
|
255
|
+
#define STATS_NET_NFS_SIZE (sizeof(struct stats_net_nfs))
|
256
|
+
|
257
|
+
/* Structure for NFS server statistics */
|
258
|
+
struct stats_net_nfsd {
|
259
|
+
unsigned int nfsd_rpccnt __attribute__ ((aligned (4)));
|
260
|
+
unsigned int nfsd_rpcbad __attribute__ ((packed));
|
261
|
+
unsigned int nfsd_netcnt __attribute__ ((packed));
|
262
|
+
unsigned int nfsd_netudpcnt __attribute__ ((packed));
|
263
|
+
unsigned int nfsd_nettcpcnt __attribute__ ((packed));
|
264
|
+
unsigned int nfsd_rchits __attribute__ ((packed));
|
265
|
+
unsigned int nfsd_rcmisses __attribute__ ((packed));
|
266
|
+
unsigned int nfsd_readcnt __attribute__ ((packed));
|
267
|
+
unsigned int nfsd_writecnt __attribute__ ((packed));
|
268
|
+
unsigned int nfsd_accesscnt __attribute__ ((packed));
|
269
|
+
unsigned int nfsd_getattcnt __attribute__ ((packed));
|
270
|
+
};
|
271
|
+
|
272
|
+
#define STATS_NET_NFSD_SIZE (sizeof(struct stats_net_nfsd))
|
273
|
+
|
274
|
+
/* Structure for IPv4 sockets statistics */
|
275
|
+
struct stats_net_sock {
|
276
|
+
unsigned int sock_inuse __attribute__ ((aligned (4)));
|
277
|
+
unsigned int tcp_inuse __attribute__ ((packed));
|
278
|
+
unsigned int tcp_tw __attribute__ ((packed));
|
279
|
+
unsigned int udp_inuse __attribute__ ((packed));
|
280
|
+
unsigned int raw_inuse __attribute__ ((packed));
|
281
|
+
unsigned int frag_inuse __attribute__ ((packed));
|
282
|
+
};
|
283
|
+
|
284
|
+
#define STATS_NET_SOCK_SIZE (sizeof(struct stats_net_sock))
|
285
|
+
|
286
|
+
/* Structure for IP statistics */
|
287
|
+
struct stats_net_ip {
|
288
|
+
unsigned long InReceives __attribute__ ((aligned (8)));
|
289
|
+
unsigned long ForwDatagrams __attribute__ ((aligned (8)));
|
290
|
+
unsigned long InDelivers __attribute__ ((aligned (8)));
|
291
|
+
unsigned long OutRequests __attribute__ ((aligned (8)));
|
292
|
+
unsigned long ReasmReqds __attribute__ ((aligned (8)));
|
293
|
+
unsigned long ReasmOKs __attribute__ ((aligned (8)));
|
294
|
+
unsigned long FragOKs __attribute__ ((aligned (8)));
|
295
|
+
unsigned long FragCreates __attribute__ ((aligned (8)));
|
296
|
+
};
|
297
|
+
|
298
|
+
#define STATS_NET_IP_SIZE (sizeof(struct stats_net_ip))
|
299
|
+
|
300
|
+
/* Structure for IP errors statistics */
|
301
|
+
struct stats_net_eip {
|
302
|
+
unsigned long InHdrErrors __attribute__ ((aligned (8)));
|
303
|
+
unsigned long InAddrErrors __attribute__ ((aligned (8)));
|
304
|
+
unsigned long InUnknownProtos __attribute__ ((aligned (8)));
|
305
|
+
unsigned long InDiscards __attribute__ ((aligned (8)));
|
306
|
+
unsigned long OutDiscards __attribute__ ((aligned (8)));
|
307
|
+
unsigned long OutNoRoutes __attribute__ ((aligned (8)));
|
308
|
+
unsigned long ReasmFails __attribute__ ((aligned (8)));
|
309
|
+
unsigned long FragFails __attribute__ ((aligned (8)));
|
310
|
+
};
|
311
|
+
|
312
|
+
#define STATS_NET_EIP_SIZE (sizeof(struct stats_net_eip))
|
313
|
+
|
314
|
+
/* Structure for ICMP statistics */
|
315
|
+
struct stats_net_icmp {
|
316
|
+
unsigned long InMsgs __attribute__ ((aligned (8)));
|
317
|
+
unsigned long OutMsgs __attribute__ ((aligned (8)));
|
318
|
+
unsigned long InEchos __attribute__ ((aligned (8)));
|
319
|
+
unsigned long InEchoReps __attribute__ ((aligned (8)));
|
320
|
+
unsigned long OutEchos __attribute__ ((aligned (8)));
|
321
|
+
unsigned long OutEchoReps __attribute__ ((aligned (8)));
|
322
|
+
unsigned long InTimestamps __attribute__ ((aligned (8)));
|
323
|
+
unsigned long InTimestampReps __attribute__ ((aligned (8)));
|
324
|
+
unsigned long OutTimestamps __attribute__ ((aligned (8)));
|
325
|
+
unsigned long OutTimestampReps __attribute__ ((aligned (8)));
|
326
|
+
unsigned long InAddrMasks __attribute__ ((aligned (8)));
|
327
|
+
unsigned long InAddrMaskReps __attribute__ ((aligned (8)));
|
328
|
+
unsigned long OutAddrMasks __attribute__ ((aligned (8)));
|
329
|
+
unsigned long OutAddrMaskReps __attribute__ ((aligned (8)));
|
330
|
+
};
|
331
|
+
|
332
|
+
#define STATS_NET_ICMP_SIZE (sizeof(struct stats_net_icmp))
|
333
|
+
|
334
|
+
/* Structure for ICMP error message statistics */
|
335
|
+
struct stats_net_eicmp {
|
336
|
+
unsigned long InErrors __attribute__ ((aligned (8)));
|
337
|
+
unsigned long OutErrors __attribute__ ((aligned (8)));
|
338
|
+
unsigned long InDestUnreachs __attribute__ ((aligned (8)));
|
339
|
+
unsigned long OutDestUnreachs __attribute__ ((aligned (8)));
|
340
|
+
unsigned long InTimeExcds __attribute__ ((aligned (8)));
|
341
|
+
unsigned long OutTimeExcds __attribute__ ((aligned (8)));
|
342
|
+
unsigned long InParmProbs __attribute__ ((aligned (8)));
|
343
|
+
unsigned long OutParmProbs __attribute__ ((aligned (8)));
|
344
|
+
unsigned long InSrcQuenchs __attribute__ ((aligned (8)));
|
345
|
+
unsigned long OutSrcQuenchs __attribute__ ((aligned (8)));
|
346
|
+
unsigned long InRedirects __attribute__ ((aligned (8)));
|
347
|
+
unsigned long OutRedirects __attribute__ ((aligned (8)));
|
348
|
+
};
|
349
|
+
|
350
|
+
#define STATS_NET_EICMP_SIZE (sizeof(struct stats_net_eicmp))
|
351
|
+
|
352
|
+
/* Structure for TCP statistics */
|
353
|
+
struct stats_net_tcp {
|
354
|
+
unsigned long ActiveOpens __attribute__ ((aligned (8)));
|
355
|
+
unsigned long PassiveOpens __attribute__ ((aligned (8)));
|
356
|
+
unsigned long InSegs __attribute__ ((aligned (8)));
|
357
|
+
unsigned long OutSegs __attribute__ ((aligned (8)));
|
358
|
+
};
|
359
|
+
|
360
|
+
#define STATS_NET_TCP_SIZE (sizeof(struct stats_net_tcp))
|
361
|
+
|
362
|
+
/* Structure for TCP errors statistics */
|
363
|
+
struct stats_net_etcp {
|
364
|
+
unsigned long AttemptFails __attribute__ ((aligned (8)));
|
365
|
+
unsigned long EstabResets __attribute__ ((aligned (8)));
|
366
|
+
unsigned long RetransSegs __attribute__ ((aligned (8)));
|
367
|
+
unsigned long InErrs __attribute__ ((aligned (8)));
|
368
|
+
unsigned long OutRsts __attribute__ ((aligned (8)));
|
369
|
+
};
|
370
|
+
|
371
|
+
#define STATS_NET_ETCP_SIZE (sizeof(struct stats_net_etcp))
|
372
|
+
|
373
|
+
/* Structure for UDP statistics */
|
374
|
+
struct stats_net_udp {
|
375
|
+
unsigned long InDatagrams __attribute__ ((aligned (8)));
|
376
|
+
unsigned long OutDatagrams __attribute__ ((aligned (8)));
|
377
|
+
unsigned long NoPorts __attribute__ ((aligned (8)));
|
378
|
+
unsigned long InErrors __attribute__ ((aligned (8)));
|
379
|
+
};
|
380
|
+
|
381
|
+
#define STATS_NET_UDP_SIZE (sizeof(struct stats_net_udp))
|
382
|
+
|
383
|
+
/* Structure for IPv6 statistics */
|
384
|
+
struct stats_net_ip6 {
|
385
|
+
unsigned long InReceives6 __attribute__ ((aligned (8)));
|
386
|
+
unsigned long OutForwDatagrams6 __attribute__ ((aligned (8)));
|
387
|
+
unsigned long InDelivers6 __attribute__ ((aligned (8)));
|
388
|
+
unsigned long OutRequests6 __attribute__ ((aligned (8)));
|
389
|
+
unsigned long ReasmReqds6 __attribute__ ((aligned (8)));
|
390
|
+
unsigned long ReasmOKs6 __attribute__ ((aligned (8)));
|
391
|
+
unsigned long InMcastPkts6 __attribute__ ((aligned (8)));
|
392
|
+
unsigned long OutMcastPkts6 __attribute__ ((aligned (8)));
|
393
|
+
unsigned long FragOKs6 __attribute__ ((aligned (8)));
|
394
|
+
unsigned long FragCreates6 __attribute__ ((aligned (8)));
|
395
|
+
};
|
396
|
+
|
397
|
+
#define STATS_NET_IP6_SIZE (sizeof(struct stats_net_ip6))
|
398
|
+
|
399
|
+
/* Structure for IPv6 errors statistics */
|
400
|
+
struct stats_net_eip6 {
|
401
|
+
unsigned long InHdrErrors6 __attribute__ ((aligned (8)));
|
402
|
+
unsigned long InAddrErrors6 __attribute__ ((aligned (8)));
|
403
|
+
unsigned long InUnknownProtos6 __attribute__ ((aligned (8)));
|
404
|
+
unsigned long InTooBigErrors6 __attribute__ ((aligned (8)));
|
405
|
+
unsigned long InDiscards6 __attribute__ ((aligned (8)));
|
406
|
+
unsigned long OutDiscards6 __attribute__ ((aligned (8)));
|
407
|
+
unsigned long InNoRoutes6 __attribute__ ((aligned (8)));
|
408
|
+
unsigned long OutNoRoutes6 __attribute__ ((aligned (8)));
|
409
|
+
unsigned long ReasmFails6 __attribute__ ((aligned (8)));
|
410
|
+
unsigned long FragFails6 __attribute__ ((aligned (8)));
|
411
|
+
unsigned long InTruncatedPkts6 __attribute__ ((aligned (8)));
|
412
|
+
};
|
413
|
+
|
414
|
+
#define STATS_NET_EIP6_SIZE (sizeof(struct stats_net_eip6))
|
415
|
+
|
416
|
+
/* Structure for ICMPv6 statistics */
|
417
|
+
struct stats_net_icmp6 {
|
418
|
+
unsigned long InMsgs6 __attribute__ ((aligned (8)));
|
419
|
+
unsigned long OutMsgs6 __attribute__ ((aligned (8)));
|
420
|
+
unsigned long InEchos6 __attribute__ ((aligned (8)));
|
421
|
+
unsigned long InEchoReplies6 __attribute__ ((aligned (8)));
|
422
|
+
unsigned long OutEchoReplies6 __attribute__ ((aligned (8)));
|
423
|
+
unsigned long InGroupMembQueries6 __attribute__ ((aligned (8)));
|
424
|
+
unsigned long InGroupMembResponses6 __attribute__ ((aligned (8)));
|
425
|
+
unsigned long OutGroupMembResponses6 __attribute__ ((aligned (8)));
|
426
|
+
unsigned long InGroupMembReductions6 __attribute__ ((aligned (8)));
|
427
|
+
unsigned long OutGroupMembReductions6 __attribute__ ((aligned (8)));
|
428
|
+
unsigned long InRouterSolicits6 __attribute__ ((aligned (8)));
|
429
|
+
unsigned long OutRouterSolicits6 __attribute__ ((aligned (8)));
|
430
|
+
unsigned long InRouterAdvertisements6 __attribute__ ((aligned (8)));
|
431
|
+
unsigned long InNeighborSolicits6 __attribute__ ((aligned (8)));
|
432
|
+
unsigned long OutNeighborSolicits6 __attribute__ ((aligned (8)));
|
433
|
+
unsigned long InNeighborAdvertisements6 __attribute__ ((aligned (8)));
|
434
|
+
unsigned long OutNeighborAdvertisements6 __attribute__ ((aligned (8)));
|
435
|
+
};
|
436
|
+
|
437
|
+
#define STATS_NET_ICMP6_SIZE (sizeof(struct stats_net_icmp6))
|
438
|
+
|
439
|
+
/* Structure for ICMPv6 error message statistics */
|
440
|
+
struct stats_net_eicmp6 {
|
441
|
+
unsigned long InErrors6 __attribute__ ((aligned (8)));
|
442
|
+
unsigned long InDestUnreachs6 __attribute__ ((aligned (8)));
|
443
|
+
unsigned long OutDestUnreachs6 __attribute__ ((aligned (8)));
|
444
|
+
unsigned long InTimeExcds6 __attribute__ ((aligned (8)));
|
445
|
+
unsigned long OutTimeExcds6 __attribute__ ((aligned (8)));
|
446
|
+
unsigned long InParmProblems6 __attribute__ ((aligned (8)));
|
447
|
+
unsigned long OutParmProblems6 __attribute__ ((aligned (8)));
|
448
|
+
unsigned long InRedirects6 __attribute__ ((aligned (8)));
|
449
|
+
unsigned long OutRedirects6 __attribute__ ((aligned (8)));
|
450
|
+
unsigned long InPktTooBigs6 __attribute__ ((aligned (8)));
|
451
|
+
unsigned long OutPktTooBigs6 __attribute__ ((aligned (8)));
|
452
|
+
};
|
453
|
+
|
454
|
+
#define STATS_NET_EICMP6_SIZE (sizeof(struct stats_net_eicmp6))
|
455
|
+
|
456
|
+
/* Structure for UDPv6 statistics */
|
457
|
+
struct stats_net_udp6 {
|
458
|
+
unsigned long InDatagrams6 __attribute__ ((aligned (8)));
|
459
|
+
unsigned long OutDatagrams6 __attribute__ ((aligned (8)));
|
460
|
+
unsigned long NoPorts6 __attribute__ ((aligned (8)));
|
461
|
+
unsigned long InErrors6 __attribute__ ((aligned (8)));
|
462
|
+
};
|
463
|
+
|
464
|
+
#define STATS_NET_UDP6_SIZE (sizeof(struct stats_net_udp6))
|
465
|
+
|
466
|
+
/* Structure for IPv6 sockets statistics */
|
467
|
+
struct stats_net_sock6 {
|
468
|
+
unsigned int tcp6_inuse __attribute__ ((aligned (4)));
|
469
|
+
unsigned int udp6_inuse __attribute__ ((packed));
|
470
|
+
unsigned int raw6_inuse __attribute__ ((packed));
|
471
|
+
unsigned int frag6_inuse __attribute__ ((packed));
|
472
|
+
};
|
473
|
+
|
474
|
+
#define STATS_NET_SOCK6_SIZE (sizeof(struct stats_net_sock6))
|
475
|
+
|
476
|
+
/*
|
477
|
+
* Structure for CPU frequency statistics.
|
478
|
+
* In activity buffer: First structure is for global CPU utilisation ("all").
|
479
|
+
* Following structures are for each individual CPU (0, 1, etc.)
|
480
|
+
*/
|
481
|
+
struct stats_pwr_cpufreq {
|
482
|
+
unsigned long cpufreq __attribute__ ((aligned (8)));
|
483
|
+
};
|
484
|
+
|
485
|
+
#define STATS_PWR_CPUFREQ_SIZE (sizeof(struct stats_pwr_cpufreq))
|
486
|
+
|
487
|
+
/*
|
488
|
+
* Structure for fan statistics.
|
489
|
+
*/
|
490
|
+
struct stats_pwr_fan {
|
491
|
+
double rpm __attribute__ ((aligned (8)));
|
492
|
+
double rpm_min __attribute__ ((aligned (8)));
|
493
|
+
char device[MAX_SENSORS_DEV_LEN] __attribute__ ((aligned (8)));
|
494
|
+
};
|
495
|
+
|
496
|
+
#define STATS_PWR_FAN_SIZE (sizeof(struct stats_pwr_fan))
|
497
|
+
|
498
|
+
/*
|
499
|
+
* Structure for device temperature statistics.
|
500
|
+
*/
|
501
|
+
struct stats_pwr_temp {
|
502
|
+
double temp __attribute__ ((aligned (8)));
|
503
|
+
double temp_min __attribute__ ((aligned (8)));
|
504
|
+
double temp_max __attribute__ ((aligned (8)));
|
505
|
+
char device[MAX_SENSORS_DEV_LEN] __attribute__ ((aligned (8)));
|
506
|
+
};
|
507
|
+
|
508
|
+
#define STATS_PWR_TEMP_SIZE (sizeof(struct stats_pwr_temp))
|
509
|
+
|
510
|
+
/*
|
511
|
+
* Structure for voltage inputs statistics.
|
512
|
+
*/
|
513
|
+
struct stats_pwr_in {
|
514
|
+
double in __attribute__ ((aligned (8)));
|
515
|
+
double in_min __attribute__ ((aligned (8)));
|
516
|
+
double in_max __attribute__ ((aligned (8)));
|
517
|
+
char device[MAX_SENSORS_DEV_LEN] __attribute__ ((aligned (8)));
|
518
|
+
};
|
519
|
+
|
520
|
+
#define STATS_PWR_IN_SIZE (sizeof(struct stats_pwr_in))
|
521
|
+
|
522
|
+
/* Structure for hugepages statistics */
|
523
|
+
struct stats_huge {
|
524
|
+
unsigned long frhkb __attribute__ ((aligned (8)));
|
525
|
+
unsigned long tlhkb __attribute__ ((aligned (8)));
|
526
|
+
};
|
527
|
+
|
528
|
+
#define STATS_HUGE_SIZE (sizeof(struct stats_memory))
|
529
|
+
|
530
|
+
/*
|
531
|
+
* Structure for weighted CPU frequency statistics.
|
532
|
+
* In activity buffer: First structure is for global CPU utilisation ("all").
|
533
|
+
* Following structures are for each individual CPU (0, 1, etc.)
|
534
|
+
*/
|
535
|
+
struct stats_pwr_wghfreq {
|
536
|
+
unsigned long long time_in_state __attribute__ ((aligned (16)));
|
537
|
+
unsigned long freq __attribute__ ((aligned (16)));
|
538
|
+
};
|
539
|
+
|
540
|
+
#define STATS_PWR_WGHFREQ_SIZE (sizeof(struct stats_pwr_wghfreq))
|
541
|
+
|
542
|
+
/*
|
543
|
+
***************************************************************************
|
544
|
+
* Prototypes for functions used to read system statistics
|
545
|
+
***************************************************************************
|
546
|
+
*/
|
547
|
+
|
548
|
+
extern void
|
549
|
+
read_stat_cpu(struct stats_cpu *, int,
|
550
|
+
unsigned long long *, unsigned long long *);
|
551
|
+
extern void
|
552
|
+
read_stat_pcsw(struct stats_pcsw *);
|
553
|
+
extern void
|
554
|
+
read_stat_irq(struct stats_irq *, int);
|
555
|
+
extern void
|
556
|
+
read_loadavg(struct stats_queue *);
|
557
|
+
extern void
|
558
|
+
read_meminfo(struct stats_memory *);
|
559
|
+
extern void
|
560
|
+
read_vmstat_swap(struct stats_swap *);
|
561
|
+
extern void
|
562
|
+
read_vmstat_paging(struct stats_paging *);
|
563
|
+
extern void
|
564
|
+
read_diskstats_io(struct stats_io *);
|
565
|
+
extern void
|
566
|
+
read_diskstats_disk(struct stats_disk *, int, int);
|
567
|
+
extern void
|
568
|
+
read_tty_driver_serial(struct stats_serial *, int);
|
569
|
+
extern void
|
570
|
+
read_kernel_tables(struct stats_ktables *);
|
571
|
+
extern void
|
572
|
+
read_net_dev(struct stats_net_dev *, int);
|
573
|
+
extern void
|
574
|
+
read_net_edev(struct stats_net_edev *, int);
|
575
|
+
extern void
|
576
|
+
read_net_nfs(struct stats_net_nfs *);
|
577
|
+
extern void
|
578
|
+
read_net_nfsd(struct stats_net_nfsd *);
|
579
|
+
extern void
|
580
|
+
read_net_sock(struct stats_net_sock *);
|
581
|
+
extern void
|
582
|
+
read_net_ip(struct stats_net_ip *);
|
583
|
+
extern void
|
584
|
+
read_net_eip(struct stats_net_eip *);
|
585
|
+
extern void
|
586
|
+
read_net_icmp(struct stats_net_icmp *);
|
587
|
+
extern void
|
588
|
+
read_net_eicmp(struct stats_net_eicmp *);
|
589
|
+
extern void
|
590
|
+
read_net_tcp(struct stats_net_tcp *);
|
591
|
+
extern void
|
592
|
+
read_net_etcp(struct stats_net_etcp *);
|
593
|
+
extern void
|
594
|
+
read_net_udp(struct stats_net_udp *);
|
595
|
+
extern void
|
596
|
+
read_uptime(unsigned long long *);
|
597
|
+
extern void
|
598
|
+
read_net_sock6(struct stats_net_sock6 *);
|
599
|
+
extern void
|
600
|
+
read_net_ip6(struct stats_net_ip6 *);
|
601
|
+
extern void
|
602
|
+
read_net_eip6(struct stats_net_eip6 *);
|
603
|
+
extern void
|
604
|
+
read_net_icmp6(struct stats_net_icmp6 *);
|
605
|
+
extern void
|
606
|
+
read_net_eicmp6(struct stats_net_eicmp6 *);
|
607
|
+
extern void
|
608
|
+
read_net_udp6(struct stats_net_udp6 *);
|
609
|
+
extern void
|
610
|
+
read_cpuinfo(struct stats_pwr_cpufreq *, int);
|
611
|
+
extern void
|
612
|
+
read_fan(struct stats_pwr_fan *, int);
|
613
|
+
extern void
|
614
|
+
read_temp(struct stats_pwr_temp *, int);
|
615
|
+
extern void
|
616
|
+
read_in(struct stats_pwr_in *, int);
|
617
|
+
extern void
|
618
|
+
read_meminfo_huge(struct stats_huge *);
|
619
|
+
extern void
|
620
|
+
read_time_in_state(struct stats_pwr_wghfreq *, int, int);
|
621
|
+
|
622
|
+
/*
|
623
|
+
***************************************************************************
|
624
|
+
* Prototypes for functions used to count number of items
|
625
|
+
***************************************************************************
|
626
|
+
*/
|
627
|
+
|
628
|
+
extern int
|
629
|
+
get_irq_nr(void);
|
630
|
+
extern int
|
631
|
+
get_serial_nr(void);
|
632
|
+
extern int
|
633
|
+
get_iface_nr(void);
|
634
|
+
extern int
|
635
|
+
get_diskstats_dev_nr(int, int);
|
636
|
+
extern int
|
637
|
+
get_disk_nr(unsigned int);
|
638
|
+
extern int
|
639
|
+
get_cpu_nr(unsigned int);
|
640
|
+
extern int
|
641
|
+
get_irqcpu_nr(char *, int, int);
|
642
|
+
extern int
|
643
|
+
get_fan_nr(void);
|
644
|
+
extern int
|
645
|
+
get_temp_nr(void);
|
646
|
+
extern int
|
647
|
+
get_in_nr(void);
|
648
|
+
extern int
|
649
|
+
get_freq_nr(void);
|
650
|
+
|
651
|
+
#endif /* _RD_STATS_H */
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* sysstat: System performance tools for Linux
|
3
|
+
* (C) 1999-2010 by Sebastien Godard (sysstat <at> orange.fr)
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef _SYSCONFIG_H
|
7
|
+
#define _SYSCONFIG_H
|
8
|
+
|
9
|
+
/* sysstat configuration directory */
|
10
|
+
#define IOCONF "/etc/sysconfig/sysstat.ioconf"
|
11
|
+
#define LOCAL_IOCONF "./sysstat.ioconf"
|
12
|
+
|
13
|
+
#endif /* _SYSCONFIG_H */
|