]> granicus.if.org Git - sysstat/blob - rd_stats.h
sar: Add discard I/O metrics to "sar -b" output
[sysstat] / rd_stats.h
1 /*
2  * rd_stats.h: Include file used to read system statistics
3  * (C) 1999-2018 by Sebastien Godard (sysstat <at> orange.fr)
4  */
5
6 #ifndef _RD_STATS_H
7 #define _RD_STATS_H
8
9 /*
10  ***************************************************************************
11  * Miscellaneous constants
12  ***************************************************************************
13  */
14
15 /* Get IFNAMSIZ */
16 #include <net/if.h>
17 #ifndef IFNAMSIZ
18 #define IFNAMSIZ        16
19 #endif
20
21 /* Maximum length of block device name */
22 #define MAX_DEV_LEN     128
23 /* Maximum length of network interface name */
24 #define MAX_IFACE_LEN   IFNAMSIZ
25 /* Maximum length of USB manufacturer string */
26 #define MAX_MANUF_LEN   24
27 /* Maximum length of USB product string */
28 #define MAX_PROD_LEN    48
29 /* Maximum length of filesystem name */
30 #define MAX_FS_LEN      128
31 /* Maximum length of FC host name */
32 #define MAX_FCH_LEN     16
33
34 #define CNT_PART        1
35 #define CNT_ALL_DEV     0
36 #define CNT_USED_DEV    1
37
38 #define K_DUPLEX_HALF   "half"
39 #define K_DUPLEX_FULL   "full"
40
41 #define C_DUPLEX_HALF   1
42 #define C_DUPLEX_FULL   2
43
44 /* Type for all functions counting items. Value can be negative (-1) */
45 #define __nr_t          int
46
47 /*
48  ***************************************************************************
49  * System files containing statistics
50  ***************************************************************************
51  */
52
53 /* Files */
54 #define PROC            "/proc"
55 #define SERIAL          "/proc/tty/driver/serial"
56 #define FDENTRY_STATE   "/proc/sys/fs/dentry-state"
57 #define FFILE_NR        "/proc/sys/fs/file-nr"
58 #define FINODE_STATE    "/proc/sys/fs/inode-state"
59 #define PTY_NR          "/proc/sys/kernel/pty/nr"
60 #define NET_DEV         "/proc/net/dev"
61 #define NET_SOCKSTAT    "/proc/net/sockstat"
62 #define NET_SOCKSTAT6   "/proc/net/sockstat6"
63 #define NET_RPC_NFS     "/proc/net/rpc/nfs"
64 #define NET_RPC_NFSD    "/proc/net/rpc/nfsd"
65 #define NET_SOFTNET     "/proc/net/softnet_stat"
66 #define LOADAVG         "/proc/loadavg"
67 #define VMSTAT          "/proc/vmstat"
68 #define NET_SNMP        "/proc/net/snmp"
69 #define NET_SNMP6       "/proc/net/snmp6"
70 #define CPUINFO         "/proc/cpuinfo"
71 #define MTAB            "/etc/mtab"
72 #define IF_DUPLEX       "/sys/class/net/%s/duplex"
73 #define IF_SPEED        "/sys/class/net/%s/speed"
74 #define FC_RX_FRAMES    "%s/%s/statistics/rx_frames"
75 #define FC_TX_FRAMES    "%s/%s/statistics/tx_frames"
76 #define FC_RX_WORDS     "%s/%s/statistics/rx_words"
77 #define FC_TX_WORDS     "%s/%s/statistics/tx_words"
78
79 /*
80  ***************************************************************************
81  * Definitions of structures for system statistics.
82  * WARNING: Fields order matters for SVG graphs!
83  ***************************************************************************
84  */
85
86 #define SIZEOF_LONG_64BIT       8
87 #define ULL_ALIGNMENT_WIDTH     8
88 #define UL_ALIGNMENT_WIDTH      SIZEOF_LONG_64BIT
89 #define U_ALIGNMENT_WIDTH       4
90
91 #define MAP_SIZE(m)     ((m[0] * ULL_ALIGNMENT_WIDTH) + \
92                          (m[1] * UL_ALIGNMENT_WIDTH) +  \
93                          (m[2] * U_ALIGNMENT_WIDTH))
94
95 /*
96  * Structure for CPU statistics.
97  * In activity buffer: First structure is for global CPU utilisation ("all").
98  * Following structures are for each individual CPU (0, 1, etc.)
99  */
100 struct stats_cpu {
101         unsigned long long cpu_user;
102         unsigned long long cpu_nice;
103         unsigned long long cpu_sys;
104         unsigned long long cpu_idle;
105         unsigned long long cpu_iowait;
106         unsigned long long cpu_steal;
107         unsigned long long cpu_hardirq;
108         unsigned long long cpu_softirq;
109         unsigned long long cpu_guest;
110         unsigned long long cpu_guest_nice;
111 };
112
113 #define STATS_CPU_SIZE  (sizeof(struct stats_cpu))
114 #define STATS_CPU_ULL   10
115 #define STATS_CPU_UL    0
116 #define STATS_CPU_U     0
117
118 /*
119  * Structure for task creation and context switch statistics.
120  * The attribute (aligned(16)) is necessary so that sizeof(structure) has
121  * the same value on 32 and 64-bit architectures.
122  */
123 struct stats_pcsw {
124         unsigned long long context_switch;
125         unsigned long      processes    __attribute__ ((aligned (8)));
126 };
127
128 #define STATS_PCSW_SIZE (sizeof(struct stats_pcsw))
129 #define STATS_PCSW_ULL  1
130 #define STATS_PCSW_UL   1
131 #define STATS_PCSW_U    0
132
133 /*
134  * Structure for interrupts statistics.
135  * In activity buffer: First structure is for total number of interrupts ("SUM").
136  * Following structures are for each individual interrupt (0, 1, etc.)
137  */
138 struct stats_irq {
139         unsigned long long irq_nr;
140 };
141
142 #define STATS_IRQ_SIZE  (sizeof(struct stats_irq))
143 #define STATS_IRQ_ULL   1
144 #define STATS_IRQ_UL    0
145 #define STATS_IRQ_U     0
146
147 /* Structure for swapping statistics */
148 struct stats_swap {
149         unsigned long pswpin    __attribute__ ((aligned (8)));
150         unsigned long pswpout   __attribute__ ((aligned (8)));
151 };
152
153 #define STATS_SWAP_SIZE (sizeof(struct stats_swap))
154 #define STATS_SWAP_ULL  0
155 #define STATS_SWAP_UL   2
156 #define STATS_SWAP_U    0
157
158 /* Structure for paging statistics */
159 struct stats_paging {
160         unsigned long pgpgin            __attribute__ ((aligned (8)));
161         unsigned long pgpgout           __attribute__ ((aligned (8)));
162         unsigned long pgfault           __attribute__ ((aligned (8)));
163         unsigned long pgmajfault        __attribute__ ((aligned (8)));
164         unsigned long pgfree            __attribute__ ((aligned (8)));
165         unsigned long pgscan_kswapd     __attribute__ ((aligned (8)));
166         unsigned long pgscan_direct     __attribute__ ((aligned (8)));
167         unsigned long pgsteal           __attribute__ ((aligned (8)));
168 };
169
170 #define STATS_PAGING_SIZE       (sizeof(struct stats_paging))
171 #define STATS_PAGING_ULL        0
172 #define STATS_PAGING_UL         8
173 #define STATS_PAGING_U          0
174
175 /* Structure for I/O and transfer rate statistics */
176 struct stats_io {
177         unsigned long long dk_drive;
178         unsigned long long dk_drive_rio;
179         unsigned long long dk_drive_wio;
180         unsigned long long dk_drive_rblk;
181         unsigned long long dk_drive_wblk;
182         unsigned long long dk_drive_dio;
183         unsigned long long dk_drive_dblk;
184 };
185
186 #define STATS_IO_SIZE   (sizeof(struct stats_io))
187 #define STATS_IO_ULL    7
188 #define STATS_IO_UL     0
189 #define STATS_IO_U      0
190
191 /* Structure for memory and swap space utilization statistics */
192 struct stats_memory {
193         unsigned long long frmkb;
194         unsigned long long bufkb;
195         unsigned long long camkb;
196         unsigned long long tlmkb;
197         unsigned long long frskb;
198         unsigned long long tlskb;
199         unsigned long long caskb;
200         unsigned long long comkb;
201         unsigned long long activekb;
202         unsigned long long inactkb;
203         unsigned long long dirtykb;
204         unsigned long long anonpgkb;
205         unsigned long long slabkb;
206         unsigned long long kstackkb;
207         unsigned long long pgtblkb;
208         unsigned long long vmusedkb;
209         unsigned long long availablekb;
210 };
211
212 #define STATS_MEMORY_SIZE       (sizeof(struct stats_memory))
213 #define STATS_MEMORY_ULL        17
214 #define STATS_MEMORY_UL         0
215 #define STATS_MEMORY_U          0
216
217 /* Structure for kernel tables statistics */
218 struct stats_ktables {
219         unsigned long long file_used;
220         unsigned long long inode_used;
221         unsigned long long dentry_stat;
222         unsigned long long pty_nr;
223 };
224
225 #define STATS_KTABLES_SIZE      (sizeof(struct stats_ktables))
226 #define STATS_KTABLES_ULL       4
227 #define STATS_KTABLES_UL        0
228 #define STATS_KTABLES_U         0
229
230 /* Structure for queue and load statistics */
231 struct stats_queue {
232         unsigned long long nr_running;
233         unsigned long long procs_blocked;
234         unsigned long long nr_threads;
235         unsigned int       load_avg_1;
236         unsigned int       load_avg_5;
237         unsigned int       load_avg_15;
238 };
239
240 #define STATS_QUEUE_SIZE        (sizeof(struct stats_queue))
241 #define STATS_QUEUE_ULL         3
242 #define STATS_QUEUE_UL          0
243 #define STATS_QUEUE_U           3
244
245 /* Structure for serial statistics */
246 struct stats_serial {
247         unsigned int rx;
248         unsigned int tx;
249         unsigned int frame;
250         unsigned int parity;
251         unsigned int brk;
252         unsigned int overrun;
253         unsigned int line;
254 };
255
256 #define STATS_SERIAL_SIZE       (sizeof(struct stats_serial))
257 #define STATS_SERIAL_ULL        0
258 #define STATS_SERIAL_UL         0
259 #define STATS_SERIAL_U          7
260
261 /* Structure for block devices statistics */
262 struct stats_disk {
263         unsigned long long nr_ios;
264         unsigned long      rd_sect      __attribute__ ((aligned (8)));
265         unsigned long      wr_sect      __attribute__ ((aligned (8)));
266         unsigned long      dc_sect      __attribute__ ((aligned (8)));
267         unsigned int       rd_ticks     __attribute__ ((aligned (8)));
268         unsigned int       wr_ticks;
269         unsigned int       tot_ticks;
270         unsigned int       rq_ticks;
271         unsigned int       major;
272         unsigned int       minor;
273         unsigned int       dc_ticks;
274 };
275
276 #define STATS_DISK_SIZE (sizeof(struct stats_disk))
277 #define STATS_DISK_ULL  1
278 #define STATS_DISK_UL   3
279 #define STATS_DISK_U    7
280
281 /* Structure for network interfaces statistics */
282 struct stats_net_dev {
283         unsigned long long rx_packets;
284         unsigned long long tx_packets;
285         unsigned long long rx_bytes;
286         unsigned long long tx_bytes;
287         unsigned long long rx_compressed;
288         unsigned long long tx_compressed;
289         unsigned long long multicast;
290         unsigned int       speed;
291         char               interface[MAX_IFACE_LEN];
292         char               duplex;
293 };
294
295 #define STATS_NET_DEV_SIZE      (sizeof(struct stats_net_dev))
296 #define STATS_NET_DEV_SIZE2CMP  (STATS_NET_DEV_SIZE - MAX_IFACE_LEN - 1)
297 #define STATS_NET_DEV_ULL       7
298 #define STATS_NET_DEV_UL        0
299 #define STATS_NET_DEV_U         1
300
301 /* Structure for network interface errors statistics */
302 struct stats_net_edev {
303         unsigned long long collisions;
304         unsigned long long rx_errors;
305         unsigned long long tx_errors;
306         unsigned long long rx_dropped;
307         unsigned long long tx_dropped;
308         unsigned long long rx_fifo_errors;
309         unsigned long long tx_fifo_errors;
310         unsigned long long rx_frame_errors;
311         unsigned long long tx_carrier_errors;
312         char               interface[MAX_IFACE_LEN];
313 };
314
315 #define STATS_NET_EDEV_SIZE     (sizeof(struct stats_net_edev))
316 #define STATS_NET_EDEV_SIZE2CMP (STATS_NET_EDEV_SIZE - MAX_IFACE_LEN)
317 #define STATS_NET_EDEV_ULL      9
318 #define STATS_NET_EDEV_UL       0
319 #define STATS_NET_EDEV_U        0
320
321 /* Structure for NFS client statistics */
322 struct stats_net_nfs {
323         unsigned int nfs_rpccnt;
324         unsigned int nfs_rpcretrans;
325         unsigned int nfs_readcnt;
326         unsigned int nfs_writecnt;
327         unsigned int nfs_accesscnt;
328         unsigned int nfs_getattcnt;
329 };
330
331 #define STATS_NET_NFS_SIZE      (sizeof(struct stats_net_nfs))
332 #define STATS_NET_NFS_ULL       0
333 #define STATS_NET_NFS_UL        0
334 #define STATS_NET_NFS_U         6
335
336 /* Structure for NFS server statistics */
337 struct stats_net_nfsd {
338         unsigned int nfsd_rpccnt;
339         unsigned int nfsd_rpcbad;
340         unsigned int nfsd_netcnt;
341         unsigned int nfsd_netudpcnt;
342         unsigned int nfsd_nettcpcnt;
343         unsigned int nfsd_rchits;
344         unsigned int nfsd_rcmisses;
345         unsigned int nfsd_readcnt;
346         unsigned int nfsd_writecnt;
347         unsigned int nfsd_accesscnt;
348         unsigned int nfsd_getattcnt;
349 };
350
351 #define STATS_NET_NFSD_SIZE     (sizeof(struct stats_net_nfsd))
352 #define STATS_NET_NFSD_ULL      0
353 #define STATS_NET_NFSD_UL       0
354 #define STATS_NET_NFSD_U        11
355
356 /* Structure for IPv4 sockets statistics */
357 struct stats_net_sock {
358         unsigned int sock_inuse;
359         unsigned int tcp_inuse;
360         unsigned int tcp_tw;
361         unsigned int udp_inuse;
362         unsigned int raw_inuse;
363         unsigned int frag_inuse;
364 };
365
366 #define STATS_NET_SOCK_SIZE     (sizeof(struct stats_net_sock))
367 #define STATS_NET_SOCK_ULL      0
368 #define STATS_NET_SOCK_UL       0
369 #define STATS_NET_SOCK_U        6
370
371 /* Structure for IP statistics */
372 struct stats_net_ip {
373         unsigned long long InReceives;
374         unsigned long long ForwDatagrams;
375         unsigned long long InDelivers;
376         unsigned long long OutRequests;
377         unsigned long long ReasmReqds;
378         unsigned long long ReasmOKs;
379         unsigned long long FragOKs;
380         unsigned long long FragCreates;
381 };
382
383 #define STATS_NET_IP_SIZE       (sizeof(struct stats_net_ip))
384 #define STATS_NET_IP_ULL        8
385 #define STATS_NET_IP_UL         0
386 #define STATS_NET_IP_U          0
387
388 /* Structure for IP errors statistics */
389 struct stats_net_eip {
390         unsigned long long InHdrErrors;
391         unsigned long long InAddrErrors;
392         unsigned long long InUnknownProtos;
393         unsigned long long InDiscards;
394         unsigned long long OutDiscards;
395         unsigned long long OutNoRoutes;
396         unsigned long long ReasmFails;
397         unsigned long long FragFails;
398 };
399
400 #define STATS_NET_EIP_SIZE      (sizeof(struct stats_net_eip))
401 #define STATS_NET_EIP_ULL       8
402 #define STATS_NET_EIP_UL        0
403 #define STATS_NET_EIP_U         0
404
405 /* Structure for ICMP statistics */
406 struct stats_net_icmp {
407         unsigned long InMsgs            __attribute__ ((aligned (8)));
408         unsigned long OutMsgs           __attribute__ ((aligned (8)));
409         unsigned long InEchos           __attribute__ ((aligned (8)));
410         unsigned long InEchoReps        __attribute__ ((aligned (8)));
411         unsigned long OutEchos          __attribute__ ((aligned (8)));
412         unsigned long OutEchoReps       __attribute__ ((aligned (8)));
413         unsigned long InTimestamps      __attribute__ ((aligned (8)));
414         unsigned long InTimestampReps   __attribute__ ((aligned (8)));
415         unsigned long OutTimestamps     __attribute__ ((aligned (8)));
416         unsigned long OutTimestampReps  __attribute__ ((aligned (8)));
417         unsigned long InAddrMasks       __attribute__ ((aligned (8)));
418         unsigned long InAddrMaskReps    __attribute__ ((aligned (8)));
419         unsigned long OutAddrMasks      __attribute__ ((aligned (8)));
420         unsigned long OutAddrMaskReps   __attribute__ ((aligned (8)));
421 };
422
423 #define STATS_NET_ICMP_SIZE     (sizeof(struct stats_net_icmp))
424 #define STATS_NET_ICMP_ULL      0
425 #define STATS_NET_ICMP_UL       14
426 #define STATS_NET_ICMP_U        0
427
428 /* Structure for ICMP error message statistics */
429 struct stats_net_eicmp {
430         unsigned long InErrors          __attribute__ ((aligned (8)));
431         unsigned long OutErrors         __attribute__ ((aligned (8)));
432         unsigned long InDestUnreachs    __attribute__ ((aligned (8)));
433         unsigned long OutDestUnreachs   __attribute__ ((aligned (8)));
434         unsigned long InTimeExcds       __attribute__ ((aligned (8)));
435         unsigned long OutTimeExcds      __attribute__ ((aligned (8)));
436         unsigned long InParmProbs       __attribute__ ((aligned (8)));
437         unsigned long OutParmProbs      __attribute__ ((aligned (8)));
438         unsigned long InSrcQuenchs      __attribute__ ((aligned (8)));
439         unsigned long OutSrcQuenchs     __attribute__ ((aligned (8)));
440         unsigned long InRedirects       __attribute__ ((aligned (8)));
441         unsigned long OutRedirects      __attribute__ ((aligned (8)));
442 };
443
444 #define STATS_NET_EICMP_SIZE    (sizeof(struct stats_net_eicmp))
445 #define STATS_NET_EICMP_ULL     0
446 #define STATS_NET_EICMP_UL      12
447 #define STATS_NET_EICMP_U       0
448
449 /* Structure for TCP statistics */
450 struct stats_net_tcp {
451         unsigned long ActiveOpens       __attribute__ ((aligned (8)));
452         unsigned long PassiveOpens      __attribute__ ((aligned (8)));
453         unsigned long InSegs            __attribute__ ((aligned (8)));
454         unsigned long OutSegs           __attribute__ ((aligned (8)));
455 };
456
457 #define STATS_NET_TCP_SIZE      (sizeof(struct stats_net_tcp))
458 #define STATS_NET_TCP_ULL       0
459 #define STATS_NET_TCP_UL        4
460 #define STATS_NET_TCP_U         0
461
462 /* Structure for TCP errors statistics */
463 struct stats_net_etcp {
464         unsigned long AttemptFails      __attribute__ ((aligned (8)));
465         unsigned long EstabResets       __attribute__ ((aligned (8)));
466         unsigned long RetransSegs       __attribute__ ((aligned (8)));
467         unsigned long InErrs            __attribute__ ((aligned (8)));
468         unsigned long OutRsts           __attribute__ ((aligned (8)));
469 };
470
471 #define STATS_NET_ETCP_SIZE     (sizeof(struct stats_net_etcp))
472 #define STATS_NET_ETCP_ULL      0
473 #define STATS_NET_ETCP_UL       5
474 #define STATS_NET_ETCP_U        0
475
476 /* Structure for UDP statistics */
477 struct stats_net_udp {
478         unsigned long InDatagrams       __attribute__ ((aligned (8)));
479         unsigned long OutDatagrams      __attribute__ ((aligned (8)));
480         unsigned long NoPorts           __attribute__ ((aligned (8)));
481         unsigned long InErrors          __attribute__ ((aligned (8)));
482 };
483
484 #define STATS_NET_UDP_SIZE      (sizeof(struct stats_net_udp))
485 #define STATS_NET_UDP_ULL       0
486 #define STATS_NET_UDP_UL        4
487 #define STATS_NET_UDP_U         0
488
489 /* Structure for IPv6 sockets statistics */
490 struct stats_net_sock6 {
491         unsigned int tcp6_inuse;
492         unsigned int udp6_inuse;
493         unsigned int raw6_inuse;
494         unsigned int frag6_inuse;
495 };
496
497 #define STATS_NET_SOCK6_SIZE    (sizeof(struct stats_net_sock6))
498 #define STATS_NET_SOCK6_ULL     0
499 #define STATS_NET_SOCK6_UL      0
500 #define STATS_NET_SOCK6_U       4
501
502 /* Structure for IPv6 statistics */
503 struct stats_net_ip6 {
504         unsigned long long InReceives6;
505         unsigned long long OutForwDatagrams6;
506         unsigned long long InDelivers6;
507         unsigned long long OutRequests6;
508         unsigned long long ReasmReqds6;
509         unsigned long long ReasmOKs6;
510         unsigned long long InMcastPkts6;
511         unsigned long long OutMcastPkts6;
512         unsigned long long FragOKs6;
513         unsigned long long FragCreates6;
514 };
515
516 #define STATS_NET_IP6_SIZE      (sizeof(struct stats_net_ip6))
517 #define STATS_NET_IP6_ULL       10
518 #define STATS_NET_IP6_UL        0
519 #define STATS_NET_IP6_U         0
520
521 /* Structure for IPv6 errors statistics */
522 struct stats_net_eip6 {
523         unsigned long long InHdrErrors6;
524         unsigned long long InAddrErrors6;
525         unsigned long long InUnknownProtos6;
526         unsigned long long InTooBigErrors6;
527         unsigned long long InDiscards6;
528         unsigned long long OutDiscards6;
529         unsigned long long InNoRoutes6;
530         unsigned long long OutNoRoutes6;
531         unsigned long long ReasmFails6;
532         unsigned long long FragFails6;
533         unsigned long long InTruncatedPkts6;
534 };
535
536 #define STATS_NET_EIP6_SIZE     (sizeof(struct stats_net_eip6))
537 #define STATS_NET_EIP6_ULL      11
538 #define STATS_NET_EIP6_UL       0
539 #define STATS_NET_EIP6_U        0
540
541 /* Structure for ICMPv6 statistics */
542 struct stats_net_icmp6 {
543         unsigned long InMsgs6                           __attribute__ ((aligned (8)));
544         unsigned long OutMsgs6                          __attribute__ ((aligned (8)));
545         unsigned long InEchos6                          __attribute__ ((aligned (8)));
546         unsigned long InEchoReplies6                    __attribute__ ((aligned (8)));
547         unsigned long OutEchoReplies6                   __attribute__ ((aligned (8)));
548         unsigned long InGroupMembQueries6               __attribute__ ((aligned (8)));
549         unsigned long InGroupMembResponses6             __attribute__ ((aligned (8)));
550         unsigned long OutGroupMembResponses6            __attribute__ ((aligned (8)));
551         unsigned long InGroupMembReductions6            __attribute__ ((aligned (8)));
552         unsigned long OutGroupMembReductions6           __attribute__ ((aligned (8)));
553         unsigned long InRouterSolicits6                 __attribute__ ((aligned (8)));
554         unsigned long OutRouterSolicits6                __attribute__ ((aligned (8)));
555         unsigned long InRouterAdvertisements6           __attribute__ ((aligned (8)));
556         unsigned long InNeighborSolicits6               __attribute__ ((aligned (8)));
557         unsigned long OutNeighborSolicits6              __attribute__ ((aligned (8)));
558         unsigned long InNeighborAdvertisements6         __attribute__ ((aligned (8)));
559         unsigned long OutNeighborAdvertisements6        __attribute__ ((aligned (8)));
560 };
561
562 #define STATS_NET_ICMP6_SIZE    (sizeof(struct stats_net_icmp6))
563 #define STATS_NET_ICMP6_ULL     0
564 #define STATS_NET_ICMP6_UL      17
565 #define STATS_NET_ICMP6_U       0
566
567 /* Structure for ICMPv6 error message statistics */
568 struct stats_net_eicmp6 {
569         unsigned long InErrors6         __attribute__ ((aligned (8)));
570         unsigned long InDestUnreachs6   __attribute__ ((aligned (8)));
571         unsigned long OutDestUnreachs6  __attribute__ ((aligned (8)));
572         unsigned long InTimeExcds6      __attribute__ ((aligned (8)));
573         unsigned long OutTimeExcds6     __attribute__ ((aligned (8)));
574         unsigned long InParmProblems6   __attribute__ ((aligned (8)));
575         unsigned long OutParmProblems6  __attribute__ ((aligned (8)));
576         unsigned long InRedirects6      __attribute__ ((aligned (8)));
577         unsigned long OutRedirects6     __attribute__ ((aligned (8)));
578         unsigned long InPktTooBigs6     __attribute__ ((aligned (8)));
579         unsigned long OutPktTooBigs6    __attribute__ ((aligned (8)));
580 };
581
582 #define STATS_NET_EICMP6_SIZE   (sizeof(struct stats_net_eicmp6))
583 #define STATS_NET_EICMP6_ULL    0
584 #define STATS_NET_EICMP6_UL     11
585 #define STATS_NET_EICMP6_U      0
586
587 /* Structure for UDPv6 statistics */
588 struct stats_net_udp6 {
589         unsigned long InDatagrams6      __attribute__ ((aligned (8)));
590         unsigned long OutDatagrams6     __attribute__ ((aligned (8)));
591         unsigned long NoPorts6          __attribute__ ((aligned (8)));
592         unsigned long InErrors6         __attribute__ ((aligned (8)));
593 };
594
595 #define STATS_NET_UDP6_SIZE     (sizeof(struct stats_net_udp6))
596 #define STATS_NET_UDP6_ULL      0
597 #define STATS_NET_UDP6_UL       4
598 #define STATS_NET_UDP6_U        0
599
600 /*
601  * Structure for CPU frequency statistics.
602  * In activity buffer: First structure is for global CPU utilisation ("all").
603  * Following structures are for each individual CPU (0, 1, etc.)
604  */
605 struct stats_pwr_cpufreq {
606         unsigned long cpufreq   __attribute__ ((aligned (8)));
607 };
608
609 #define STATS_PWR_CPUFREQ_SIZE  (sizeof(struct stats_pwr_cpufreq))
610 #define STATS_PWR_CPUFREQ_ULL   0
611 #define STATS_PWR_CPUFREQ_UL    1
612 #define STATS_PWR_CPUFREQ_U     0
613
614 /* Structure for hugepages statistics */
615 struct stats_huge {
616         unsigned long long frhkb;
617         unsigned long long tlhkb;
618         unsigned long long rsvdhkb;
619         unsigned long long surphkb;
620 };
621
622 #define STATS_HUGE_SIZE (sizeof(struct stats_huge))
623 #define STATS_HUGE_ULL  4
624 #define STATS_HUGE_UL   0
625 #define STATS_HUGE_U    0
626
627 /*
628  * Structure for weighted CPU frequency statistics.
629  * In activity buffer: First structure is for global CPU utilisation ("all").
630  * Following structures are for each individual CPU (0, 1, etc.)
631  */
632 struct stats_pwr_wghfreq {
633         unsigned long long time_in_state;
634         unsigned long      freq         __attribute__ ((aligned (8)));
635 };
636
637 #define STATS_PWR_WGHFREQ_SIZE  (sizeof(struct stats_pwr_wghfreq))
638 #define STATS_PWR_WGHFREQ_ULL   1
639 #define STATS_PWR_WGHFREQ_UL    1
640 #define STATS_PWR_WGHFREQ_U     0
641
642 /*
643  * Structure for USB devices plugged into the system.
644  */
645 struct stats_pwr_usb {
646         unsigned int bus_nr;
647         unsigned int vendor_id;
648         unsigned int product_id;
649         unsigned int bmaxpower;
650         char         manufacturer[MAX_MANUF_LEN];
651         char         product[MAX_PROD_LEN];
652 };
653
654 #define STATS_PWR_USB_SIZE      (sizeof(struct stats_pwr_usb))
655 #define STATS_PWR_USB_ULL       0
656 #define STATS_PWR_USB_UL        0
657 #define STATS_PWR_USB_U         4
658
659 /* Structure for filesystems statistics */
660 struct stats_filesystem {
661         unsigned long long f_blocks;
662         unsigned long long f_bfree;
663         unsigned long long f_bavail;
664         unsigned long long f_files;
665         unsigned long long f_ffree;
666         char               fs_name[MAX_FS_LEN];
667         char               mountp[MAX_FS_LEN];
668 };
669
670 #define STATS_FILESYSTEM_SIZE           (sizeof(struct stats_filesystem))
671 #define STATS_FILESYSTEM_SIZE2CMP       (STATS_FILESYSTEM_SIZE - 2 * MAX_FS_LEN)
672 #define STATS_FILESYSTEM_ULL            5
673 #define STATS_FILESYSTEM_UL             0
674 #define STATS_FILESYSTEM_U              0
675
676 /* Structure for Fibre Channel HBA statistics */
677 struct stats_fchost {
678         unsigned long f_rxframes                __attribute__ ((aligned (8)));
679         unsigned long f_txframes                __attribute__ ((aligned (8)));
680         unsigned long f_rxwords                 __attribute__ ((aligned (8)));
681         unsigned long f_txwords                 __attribute__ ((aligned (8)));
682         char          fchost_name[MAX_FCH_LEN]  __attribute__ ((aligned (8)));
683 };
684
685 #define STATS_FCHOST_SIZE       (sizeof(struct stats_fchost))
686 #define STATS_FCHOST_ULL        0
687 #define STATS_FCHOST_UL         4
688 #define STATS_FCHOST_U          0
689
690 /* Structure for softnet statistics */
691 struct stats_softnet {
692         unsigned int processed;
693         unsigned int dropped;
694         unsigned int time_squeeze;
695         unsigned int received_rps;
696         unsigned int flow_limit;
697 };
698
699 #define STATS_SOFTNET_SIZE      (sizeof(struct stats_softnet))
700 #define STATS_SOFTNET_ULL       0
701 #define STATS_SOFTNET_UL        0
702 #define STATS_SOFTNET_U         5
703
704 /*
705  ***************************************************************************
706  * Prototypes for functions used to read system statistics
707  ***************************************************************************
708  */
709
710 void compute_ext_disk_stats
711         (struct stats_disk *, struct stats_disk *, unsigned long long,
712          struct ext_disk_stats *);
713 unsigned long long get_per_cpu_interval
714         (struct stats_cpu *, struct stats_cpu *);
715 __nr_t read_stat_cpu
716         (struct stats_cpu *, __nr_t);
717 __nr_t read_stat_irq
718         (struct stats_irq *, __nr_t);
719 __nr_t read_meminfo
720         (struct stats_memory *);
721 void read_uptime
722         (unsigned long long *);
723 #ifdef SOURCE_SADC
724 void oct2chr
725         (char *);
726 __nr_t read_stat_pcsw
727         (struct stats_pcsw *);
728 __nr_t read_loadavg
729         (struct stats_queue *);
730 __nr_t read_vmstat_swap
731         (struct stats_swap *);
732 __nr_t read_vmstat_paging
733         (struct stats_paging *);
734 __nr_t read_diskstats_io
735         (struct stats_io *);
736 __nr_t read_diskstats_disk
737         (struct stats_disk *, __nr_t, int);
738 __nr_t read_tty_driver_serial
739         (struct stats_serial *, __nr_t);
740 __nr_t read_kernel_tables
741         (struct stats_ktables *);
742 __nr_t read_net_dev
743         (struct stats_net_dev *, __nr_t);
744 void read_if_info
745         (struct stats_net_dev *, int);
746 __nr_t read_net_edev
747         (struct stats_net_edev *, __nr_t);
748 __nr_t read_net_nfs
749         (struct stats_net_nfs *);
750 __nr_t read_net_nfsd
751         (struct stats_net_nfsd *);
752 __nr_t read_net_sock
753         (struct stats_net_sock *);
754 __nr_t read_net_ip
755         (struct stats_net_ip *);
756 __nr_t read_net_eip
757         (struct stats_net_eip *);
758 __nr_t read_net_icmp
759         (struct stats_net_icmp *);
760 __nr_t read_net_eicmp
761         (struct stats_net_eicmp *);
762 __nr_t read_net_tcp
763         (struct stats_net_tcp *);
764 __nr_t read_net_etcp
765         (struct stats_net_etcp *);
766 __nr_t read_net_udp
767         (struct stats_net_udp *);
768 __nr_t read_net_sock6
769         (struct stats_net_sock6 *);
770 __nr_t read_net_ip6
771         (struct stats_net_ip6 *);
772 __nr_t read_net_eip6
773         (struct stats_net_eip6 *);
774 __nr_t read_net_icmp6
775         (struct stats_net_icmp6 *);
776 __nr_t read_net_eicmp6
777         (struct stats_net_eicmp6 *);
778 __nr_t read_net_udp6
779         (struct stats_net_udp6 *);
780 __nr_t read_cpuinfo
781         (struct stats_pwr_cpufreq *, __nr_t);
782 __nr_t read_meminfo_huge
783         (struct stats_huge *);
784 __nr_t read_cpu_wghfreq
785         (struct stats_pwr_wghfreq *, __nr_t, __nr_t);
786 __nr_t read_bus_usb_dev
787         (struct stats_pwr_usb *, __nr_t);
788 __nr_t read_filesystem
789         (struct stats_filesystem *, __nr_t);
790 __nr_t read_fchost
791         (struct stats_fchost *, __nr_t);
792 int read_softnet
793         (struct stats_softnet *, __nr_t, unsigned char []);
794 #endif /* SOURCE_SADC */
795
796 #endif /* _RD_STATS_H */