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