2 * iostat: report CPU and I/O statistics
3 * (C) 1999-2020 by Sebastien Godard (sysstat <at> orange.fr)
11 /* I_: iostat - D_: Display - F_: Flag */
12 #define I_D_CPU 0x000001
13 #define I_D_DISK 0x000002
14 #define I_D_TIMESTAMP 0x000004
15 #define I_D_EXTENDED 0x000008
16 #define I_D_EVERYTHING 0x000010
17 #define I_D_KILOBYTES 0x000020
18 #define I_D_ALL_DIR 0x000040
19 #define I_D_DEBUG 0x000080
20 #define I_D_UNFILTERED 0x000100
21 #define I_D_MEGABYTES 0x000200
22 #define I_D_ALL_DEVICES 0x000400
23 #define I_F_GROUP_DEFINED 0x000800
24 #define I_D_PRETTY 0x001000
25 #define I_D_PERSIST_NAME 0x002000
26 #define I_D_OMIT_SINCE_BOOT 0x004000
27 #define I_D_JSON_OUTPUT 0x008000
28 #define I_D_DEVMAP_NAME 0x010000
29 #define I_D_ISO 0x020000
30 #define I_D_GROUP_TOTAL_ONLY 0x040000
31 #define I_D_ZERO_OMIT 0x080000
32 #define I_D_UNIT 0x100000
33 #define I_D_SHORT_OUTPUT 0x200000
35 #define DISPLAY_CPU(m) (((m) & I_D_CPU) == I_D_CPU)
36 #define DISPLAY_DISK(m) (((m) & I_D_DISK) == I_D_DISK)
37 #define DISPLAY_TIMESTAMP(m) (((m) & I_D_TIMESTAMP) == I_D_TIMESTAMP)
38 #define DISPLAY_EXTENDED(m) (((m) & I_D_EXTENDED) == I_D_EXTENDED)
39 #define DISPLAY_EVERYTHING(m) (((m) & I_D_EVERYTHING) == I_D_EVERYTHING)
40 #define DISPLAY_KILOBYTES(m) (((m) & I_D_KILOBYTES) == I_D_KILOBYTES)
41 #define DISPLAY_MEGABYTES(m) (((m) & I_D_MEGABYTES) == I_D_MEGABYTES)
42 #define DISPLAY_DEBUG(m) (((m) & I_D_DEBUG) == I_D_DEBUG)
43 #define DISPLAY_UNFILTERED(m) (((m) & I_D_UNFILTERED) == I_D_UNFILTERED)
44 #define DISPLAY_ALL_DEVICES(m) (((m) & I_D_ALL_DEVICES) == I_D_ALL_DEVICES)
45 #define GROUP_DEFINED(m) (((m) & I_F_GROUP_DEFINED) == I_F_GROUP_DEFINED)
46 #define DISPLAY_PRETTY(m) (((m) & I_D_PRETTY) == I_D_PRETTY)
47 #define DISPLAY_PERSIST_NAME_I(m) (((m) & I_D_PERSIST_NAME) == I_D_PERSIST_NAME)
48 #define DISPLAY_OMIT_SINCE_BOOT(m) (((m) & I_D_OMIT_SINCE_BOOT) == I_D_OMIT_SINCE_BOOT)
49 #define DISPLAY_DEVMAP_NAME(m) (((m) & I_D_DEVMAP_NAME) == I_D_DEVMAP_NAME)
50 #define DISPLAY_ISO(m) (((m) & I_D_ISO) == I_D_ISO)
51 #define DISPLAY_GROUP_TOTAL_ONLY(m) (((m) & I_D_GROUP_TOTAL_ONLY) == I_D_GROUP_TOTAL_ONLY)
52 #define DISPLAY_ZERO_OMIT(m) (((m) & I_D_ZERO_OMIT) == I_D_ZERO_OMIT)
53 #define DISPLAY_JSON_OUTPUT(m) (((m) & I_D_JSON_OUTPUT) == I_D_JSON_OUTPUT)
54 #define DISPLAY_UNIT(m) (((m) & I_D_UNIT) == I_D_UNIT)
55 #define DISPLAY_SHORT_OUTPUT(m) (((m) & I_D_SHORT_OUTPUT) == I_D_SHORT_OUTPUT)
56 #define USE_ALL_DIR(m) (((m) & I_D_ALL_DIR) == I_D_ALL_DIR)
63 /* Environment variable */
64 #define ENV_POSIXLY_CORRECT "POSIXLY_CORRECT"
67 * Structures for I/O stats.
68 * These are now dynamically allocated.
71 /* # of sectors read */
72 unsigned long rd_sectors __attribute__ ((aligned (8)));
73 /* # of sectors written */
74 unsigned long wr_sectors __attribute__ ((packed));
75 /* # of sectors discarded */
76 unsigned long dc_sectors __attribute__ ((packed));
77 /* # of read operations issued to the device */
78 unsigned long rd_ios __attribute__ ((packed));
79 /* # of read requests merged */
80 unsigned long rd_merges __attribute__ ((packed));
81 /* # of write operations issued to the device */
82 unsigned long wr_ios __attribute__ ((packed));
83 /* # of write requests merged */
84 unsigned long wr_merges __attribute__ ((packed));
85 /* # of discard operations issued to the device */
86 unsigned long dc_ios __attribute__ ((packed));
87 /* # of discard requests merged */
88 unsigned long dc_merges __attribute__ ((packed));
89 /* # of flush requests issued to the device */
90 unsigned long fl_ios __attribute__ ((packed));
91 /* Time of read requests in queue */
92 unsigned int rd_ticks __attribute__ ((packed));
93 /* Time of write requests in queue */
94 unsigned int wr_ticks __attribute__ ((packed));
95 /* Time of discard requests in queue */
96 unsigned int dc_ticks __attribute__ ((packed));
97 /* Time of flush requests in queue */
98 unsigned int fl_ticks __attribute__ ((packed));
99 /* # of I/Os in progress */
100 unsigned int ios_pgr __attribute__ ((packed));
101 /* # of ticks total (for this device) for I/O */
102 unsigned int tot_ticks __attribute__ ((packed));
103 /* # of ticks requests spent in queue */
104 unsigned int rq_ticks __attribute__ ((packed));
107 #define IO_STATS_SIZE (sizeof(struct io_stats))
110 char name[MAX_NAME_LEN];
112 * 0: Not a whole device (T_PART)
113 * 1: whole device (T_DEV)
114 * 2: whole device and all its partitions to be read (T_PART_DEV)
115 * 3+: group name (T_GROUP) (4 means 1 device in the group, 5 means 2 devices in the group, etc.)
118 /* TRUE if device exists in /proc/diskstats or /sys. Don't apply for groups. */
120 /* major and minor numbers are set only for partitions (T_PART), not whole devices */
123 struct io_stats *dev_stats[2];
124 struct io_device *next;
127 struct ext_io_stats {
158 #endif /* _IOSTAT_H */