]> granicus.if.org Git - sysstat/blob - sa_conv.h
sysstat-12.1.3
[sysstat] / sa_conv.h
1 /*
2  * sa_conv.h: Include file for "sadf -c" command.
3  * (C) 1999-2019 by Sebastien Godard (sysstat <at> orange.fr)
4  */
5
6 #ifndef _SA_CONV_H
7 #define _SA_CONV_H
8
9 /*
10  * Header structure for previous system activity data file formats.
11  * 2171: v9.1.6 -> 10.2.1
12  * 2173: 10.3.1 -> 11.6.x
13  */
14 struct file_header_2171 {
15         unsigned long sa_ust_time       __attribute__ ((aligned (8)));
16         unsigned int sa_act_nr          __attribute__ ((aligned (8)));
17         unsigned char sa_day;
18         unsigned char sa_month;
19         unsigned char sa_year;
20         char sa_sizeof_long;
21         char sa_sysname[UTSNAME_LEN];
22         char sa_nodename[UTSNAME_LEN];
23         char sa_release[UTSNAME_LEN];
24         char sa_machine[UTSNAME_LEN];
25 };
26
27 #define FILE_HEADER_SIZE_2171   (sizeof(struct file_header_2171))
28 #define FILE_HEADER_2171_ULL_NR 0
29 #define FILE_HEADER_2171_UL_NR  1
30 #define FILE_HEADER_2171_U_NR   1
31
32 struct file_header_2173 {
33         unsigned long sa_ust_time       __attribute__ ((aligned (8)));
34         unsigned int sa_last_cpu_nr     __attribute__ ((aligned (8)));
35         unsigned int sa_act_nr;
36         unsigned int sa_vol_act_nr;
37         unsigned char sa_day;
38         unsigned char sa_month;
39         unsigned char sa_year;
40         char sa_sizeof_long;
41         char sa_sysname[UTSNAME_LEN];
42         char sa_nodename[UTSNAME_LEN];
43         char sa_release[UTSNAME_LEN];
44         char sa_machine[UTSNAME_LEN];
45 };
46
47 #define FILE_HEADER_2173_ULL_NR 0
48 #define FILE_HEADER_2173_UL_NR  1
49 #define FILE_HEADER_2173_U_NR   3
50
51 /* file_activity structure for versions older than 11.7.1 */
52 struct old_file_activity {
53         unsigned int id;
54         unsigned int magic;
55         int nr;
56         int nr2;
57         int size;
58 };
59
60 #define OLD_FILE_ACTIVITY_SIZE  (sizeof(struct old_file_activity))
61 #define OLD_FILE_ACTIVITY_ULL_NR        0
62 #define OLD_FILE_ACTIVITY_UL_NR         0
63 #define OLD_FILE_ACTIVITY_U_NR          5
64
65 /* File record header structure for versions older than 11.7.1 */
66 struct old_record_header {
67         unsigned long long uptime       __attribute__ ((aligned (16)));
68         unsigned long long uptime0      __attribute__ ((aligned (16)));
69         unsigned long ust_time          __attribute__ ((aligned (16)));
70         unsigned char record_type       __attribute__ ((aligned (8)));
71         unsigned char hour;
72         unsigned char minute;
73         unsigned char second;
74 };
75
76 #define OLD_RECORD_HEADER_SIZE  (sizeof(struct old_record_header))
77 #define OLD_RECORD_HEADER_ULL_NR        2
78 #define OLD_RECORD_HEADER_UL_NR         1
79 #define OLD_RECORD_HEADER_U_NR          0
80
81 /* Structure stats_cpu for ACTIVITY_MAGIC_BASE format */
82 struct stats_cpu_8a {
83         unsigned long long cpu_user             __attribute__ ((aligned (16)));
84         unsigned long long cpu_nice             __attribute__ ((aligned (16)));
85         unsigned long long cpu_sys              __attribute__ ((aligned (16)));
86         unsigned long long cpu_idle             __attribute__ ((aligned (16)));
87         unsigned long long cpu_iowait           __attribute__ ((aligned (16)));
88         unsigned long long cpu_steal            __attribute__ ((aligned (16)));
89         unsigned long long cpu_hardirq          __attribute__ ((aligned (16)));
90         unsigned long long cpu_softirq          __attribute__ ((aligned (16)));
91         unsigned long long cpu_guest            __attribute__ ((aligned (16)));
92         unsigned long long cpu_guest_nice       __attribute__ ((aligned (16)));
93 };
94
95 #define STATS_CPU_8A_SIZE       (sizeof(struct stats_cpu_8a))
96
97 /* Structure stats_pcsw for ACTIVITY_MAGIC_BASE format */
98 struct stats_pcsw_8a {
99         unsigned long long context_switch       __attribute__ ((aligned (16)));
100         unsigned long processes                 __attribute__ ((aligned (16)));
101 };
102
103 /* Structure stats_irq for ACTIVITY_MAGIC_BASE format */
104 struct stats_irq_8a {
105         unsigned long long irq_nr       __attribute__ ((aligned (16)));
106 };
107
108 /* Structure stats_io for ACTIVITY_MAGIC_BASE format */
109 struct stats_io_8a {
110         unsigned int dk_drive           __attribute__ ((aligned (4)));
111         unsigned int dk_drive_rio       __attribute__ ((packed));
112         unsigned int dk_drive_wio       __attribute__ ((packed));
113         unsigned int dk_drive_rblk      __attribute__ ((packed));
114         unsigned int dk_drive_wblk      __attribute__ ((packed));
115 };
116
117 /* Structure stats_memory for ACTIVITY_MAGIC_BASE format */
118 struct stats_memory_8a {
119         unsigned long frmkb             __attribute__ ((aligned (8)));
120         unsigned long bufkb             __attribute__ ((aligned (8)));
121         unsigned long camkb             __attribute__ ((aligned (8)));
122         unsigned long tlmkb             __attribute__ ((aligned (8)));
123         unsigned long frskb             __attribute__ ((aligned (8)));
124         unsigned long tlskb             __attribute__ ((aligned (8)));
125         unsigned long caskb             __attribute__ ((aligned (8)));
126         unsigned long comkb             __attribute__ ((aligned (8)));
127         unsigned long activekb          __attribute__ ((aligned (8)));
128         unsigned long inactkb           __attribute__ ((aligned (8)));
129 #define STATS_MEMORY_8A_1_SIZE  80
130         unsigned long dirtykb           __attribute__ ((aligned (8)));
131 #define STATS_MEMORY_8A_2_SIZE  88
132         unsigned long anonpgkb          __attribute__ ((aligned (8)));
133         unsigned long slabkb            __attribute__ ((aligned (8)));
134         unsigned long kstackkb          __attribute__ ((aligned (8)));
135         unsigned long pgtblkb           __attribute__ ((aligned (8)));
136         unsigned long vmusedkb          __attribute__ ((aligned (8)));
137 #define STATS_MEMORY_8A_3_SIZE  128
138         unsigned long availablekb       __attribute__ ((aligned (8)));
139 };
140
141 #define STATS_MEMORY_8A_SIZE    (sizeof(struct stats_memory_8a))
142
143 /* Structure stats_ktables for ACTIVITY_MAGIC_BASE */
144 struct stats_ktables_8a {
145         unsigned int file_used          __attribute__ ((aligned (4)));
146         unsigned int inode_used         __attribute__ ((packed));
147         unsigned int dentry_stat        __attribute__ ((packed));
148         unsigned int pty_nr             __attribute__ ((packed));
149 };
150
151 /* Structure stats_queue for ACTIVITY_MAGIC_BASE format */
152 struct stats_queue_8a {
153         unsigned long nr_running        __attribute__ ((aligned (8)));
154         unsigned int  load_avg_1        __attribute__ ((aligned (8)));
155         unsigned int  load_avg_5        __attribute__ ((packed));
156         unsigned int  load_avg_15       __attribute__ ((packed));
157         unsigned int  nr_threads        __attribute__ ((packed));
158 };
159
160 /* Structure stats_queue for ACTIVITY_MAGIC_BASE + 1 format */
161 struct stats_queue_8b {
162         unsigned long nr_running        __attribute__ ((aligned (8)));
163         unsigned long procs_blocked     __attribute__ ((aligned (8)));
164         unsigned int  load_avg_1        __attribute__ ((aligned (8)));
165         unsigned int  load_avg_5        __attribute__ ((packed));
166         unsigned int  load_avg_15       __attribute__ ((packed));
167         unsigned int  nr_threads        __attribute__ ((packed));
168 };
169
170 /* Structure stats_disk for ACTIVITY_MAGIC_BASE format */
171 struct stats_disk_8a {
172         unsigned long long rd_sect      __attribute__ ((aligned (16)));
173         unsigned long long wr_sect      __attribute__ ((aligned (16)));
174         unsigned long rd_ticks          __attribute__ ((aligned (16)));
175         unsigned long wr_ticks          __attribute__ ((aligned (8)));
176         unsigned long tot_ticks         __attribute__ ((aligned (8)));
177         unsigned long rq_ticks          __attribute__ ((aligned (8)));
178         unsigned long nr_ios            __attribute__ ((aligned (8)));
179         unsigned int  major             __attribute__ ((aligned (8)));
180         unsigned int  minor             __attribute__ ((packed));
181 };
182
183 /* Structure stats_disk for ACTIVITY_MAGIC_BASE + 1 format */
184 struct stats_disk_8b {
185         unsigned long long nr_ios       __attribute__ ((aligned (16)));
186         unsigned long rd_sect           __attribute__ ((aligned (16)));
187         unsigned long wr_sect           __attribute__ ((aligned (8)));
188         unsigned int rd_ticks           __attribute__ ((aligned (8)));
189         unsigned int wr_ticks           __attribute__ ((packed));
190         unsigned int tot_ticks          __attribute__ ((packed));
191         unsigned int rq_ticks           __attribute__ ((packed));
192         unsigned int major              __attribute__ ((packed));
193         unsigned int minor              __attribute__ ((packed));
194 };
195
196 /* Structure stats_net_dev for ACTIVITY_MAGIC_BASE format */
197 struct stats_net_dev_8a {
198         unsigned long rx_packets                __attribute__ ((aligned (8)));
199         unsigned long tx_packets                __attribute__ ((aligned (8)));
200         unsigned long rx_bytes                  __attribute__ ((aligned (8)));
201         unsigned long tx_bytes                  __attribute__ ((aligned (8)));
202         unsigned long rx_compressed             __attribute__ ((aligned (8)));
203         unsigned long tx_compressed             __attribute__ ((aligned (8)));
204         unsigned long multicast                 __attribute__ ((aligned (8)));
205         char          interface[MAX_IFACE_LEN]  __attribute__ ((aligned (8)));
206 };
207
208 /* Structure stats_net_dev for ACTIVITY_MAGIC_BASE + 1 format */
209 struct stats_net_dev_8b {
210         unsigned long long rx_packets           __attribute__ ((aligned (16)));
211         unsigned long long tx_packets           __attribute__ ((aligned (16)));
212         unsigned long long rx_bytes             __attribute__ ((aligned (16)));
213         unsigned long long tx_bytes             __attribute__ ((aligned (16)));
214         unsigned long long rx_compressed        __attribute__ ((aligned (16)));
215         unsigned long long tx_compressed        __attribute__ ((aligned (16)));
216         unsigned long long multicast            __attribute__ ((aligned (16)));
217         char          interface[MAX_IFACE_LEN]  __attribute__ ((aligned (16)));
218 };
219
220 /* Structure stats_net_dev for ACTIVITY_MAGIC_BASE + 2 format */
221 struct stats_net_dev_8c {
222         unsigned long long rx_packets           __attribute__ ((aligned (16)));
223         unsigned long long tx_packets           __attribute__ ((aligned (16)));
224         unsigned long long rx_bytes             __attribute__ ((aligned (16)));
225         unsigned long long tx_bytes             __attribute__ ((aligned (16)));
226         unsigned long long rx_compressed        __attribute__ ((aligned (16)));
227         unsigned long long tx_compressed        __attribute__ ((aligned (16)));
228         unsigned long long multicast            __attribute__ ((aligned (16)));
229         unsigned int       speed                __attribute__ ((aligned (16)));
230         char     interface[MAX_IFACE_LEN]       __attribute__ ((aligned (4)));
231         char     duplex;
232 };
233
234 /* Structure stats_net_edev for ACTIVITY_MAGIC_BASE format */
235 struct stats_net_edev_8a {
236         unsigned long collisions                __attribute__ ((aligned (8)));
237         unsigned long rx_errors                 __attribute__ ((aligned (8)));
238         unsigned long tx_errors                 __attribute__ ((aligned (8)));
239         unsigned long rx_dropped                __attribute__ ((aligned (8)));
240         unsigned long tx_dropped                __attribute__ ((aligned (8)));
241         unsigned long rx_fifo_errors            __attribute__ ((aligned (8)));
242         unsigned long tx_fifo_errors            __attribute__ ((aligned (8)));
243         unsigned long rx_frame_errors           __attribute__ ((aligned (8)));
244         unsigned long tx_carrier_errors         __attribute__ ((aligned (8)));
245         char          interface[MAX_IFACE_LEN]  __attribute__ ((aligned (8)));
246 };
247
248 /* Structure stats_net_edev for ACTIVITY_MAGIC_BASE + 1 format */
249 struct stats_net_edev_8b {
250         unsigned long long collisions           __attribute__ ((aligned (16)));
251         unsigned long long rx_errors            __attribute__ ((aligned (16)));
252         unsigned long long tx_errors            __attribute__ ((aligned (16)));
253         unsigned long long rx_dropped           __attribute__ ((aligned (16)));
254         unsigned long long tx_dropped           __attribute__ ((aligned (16)));
255         unsigned long long rx_fifo_errors       __attribute__ ((aligned (16)));
256         unsigned long long tx_fifo_errors       __attribute__ ((aligned (16)));
257         unsigned long long rx_frame_errors      __attribute__ ((aligned (16)));
258         unsigned long long tx_carrier_errors    __attribute__ ((aligned (16)));
259         char          interface[MAX_IFACE_LEN]  __attribute__ ((aligned (16)));
260 };
261
262 /* Structure stats_net_ip for ACTIVITY_MAGIC_BASE format */
263 struct stats_net_ip_8a {
264         unsigned long InReceives        __attribute__ ((aligned (8)));
265         unsigned long ForwDatagrams     __attribute__ ((aligned (8)));
266         unsigned long InDelivers        __attribute__ ((aligned (8)));
267         unsigned long OutRequests       __attribute__ ((aligned (8)));
268         unsigned long ReasmReqds        __attribute__ ((aligned (8)));
269         unsigned long ReasmOKs          __attribute__ ((aligned (8)));
270         unsigned long FragOKs           __attribute__ ((aligned (8)));
271         unsigned long FragCreates       __attribute__ ((aligned (8)));
272 };
273
274 /* Structure stats_net_ip for ACTIVITY_MAGIC_BASE + 1 format */
275 struct stats_net_ip_8b {
276         unsigned long long InReceives           __attribute__ ((aligned (16)));
277         unsigned long long ForwDatagrams        __attribute__ ((aligned (16)));
278         unsigned long long InDelivers           __attribute__ ((aligned (16)));
279         unsigned long long OutRequests          __attribute__ ((aligned (16)));
280         unsigned long long ReasmReqds           __attribute__ ((aligned (16)));
281         unsigned long long ReasmOKs             __attribute__ ((aligned (16)));
282         unsigned long long FragOKs              __attribute__ ((aligned (16)));
283         unsigned long long FragCreates          __attribute__ ((aligned (16)));
284 };
285
286 /* Structure stats_net_eip for ACTIVITY_MAGIC_BASE format */
287 struct stats_net_eip_8a {
288         unsigned long InHdrErrors       __attribute__ ((aligned (8)));
289         unsigned long InAddrErrors      __attribute__ ((aligned (8)));
290         unsigned long InUnknownProtos   __attribute__ ((aligned (8)));
291         unsigned long InDiscards        __attribute__ ((aligned (8)));
292         unsigned long OutDiscards       __attribute__ ((aligned (8)));
293         unsigned long OutNoRoutes       __attribute__ ((aligned (8)));
294         unsigned long ReasmFails        __attribute__ ((aligned (8)));
295         unsigned long FragFails         __attribute__ ((aligned (8)));
296 };
297
298 /* Structure stats_net_eip for ACTIVITY_MAGIC_BASE + 1 format */
299 struct stats_net_eip_8b {
300         unsigned long long InHdrErrors          __attribute__ ((aligned (16)));
301         unsigned long long InAddrErrors         __attribute__ ((aligned (16)));
302         unsigned long long InUnknownProtos      __attribute__ ((aligned (16)));
303         unsigned long long InDiscards           __attribute__ ((aligned (16)));
304         unsigned long long OutDiscards          __attribute__ ((aligned (16)));
305         unsigned long long OutNoRoutes          __attribute__ ((aligned (16)));
306         unsigned long long ReasmFails           __attribute__ ((aligned (16)));
307         unsigned long long FragFails            __attribute__ ((aligned (16)));
308 };
309
310 /* Structure stats_net_ip6 for ACTIVITY_MAGIC_BASE format */
311 struct stats_net_ip6_8a {
312         unsigned long InReceives6       __attribute__ ((aligned (8)));
313         unsigned long OutForwDatagrams6 __attribute__ ((aligned (8)));
314         unsigned long InDelivers6       __attribute__ ((aligned (8)));
315         unsigned long OutRequests6      __attribute__ ((aligned (8)));
316         unsigned long ReasmReqds6       __attribute__ ((aligned (8)));
317         unsigned long ReasmOKs6         __attribute__ ((aligned (8)));
318         unsigned long InMcastPkts6      __attribute__ ((aligned (8)));
319         unsigned long OutMcastPkts6     __attribute__ ((aligned (8)));
320         unsigned long FragOKs6          __attribute__ ((aligned (8)));
321         unsigned long FragCreates6      __attribute__ ((aligned (8)));
322 };
323
324 /* Structure stats_net_ip6 for ACTIVITY_MAGIC_BASE + 1 format */
325 struct stats_net_ip6_8b {
326         unsigned long long InReceives6          __attribute__ ((aligned (16)));
327         unsigned long long OutForwDatagrams6    __attribute__ ((aligned (16)));
328         unsigned long long InDelivers6          __attribute__ ((aligned (16)));
329         unsigned long long OutRequests6         __attribute__ ((aligned (16)));
330         unsigned long long ReasmReqds6          __attribute__ ((aligned (16)));
331         unsigned long long ReasmOKs6            __attribute__ ((aligned (16)));
332         unsigned long long InMcastPkts6         __attribute__ ((aligned (16)));
333         unsigned long long OutMcastPkts6        __attribute__ ((aligned (16)));
334         unsigned long long FragOKs6             __attribute__ ((aligned (16)));
335         unsigned long long FragCreates6         __attribute__ ((aligned (16)));
336 };
337
338 /* Structure stats_net_eip6 for ACTIVITY_MAGIC_BASE format */
339 struct stats_net_eip6_8a {
340         unsigned long InHdrErrors6      __attribute__ ((aligned (8)));
341         unsigned long InAddrErrors6     __attribute__ ((aligned (8)));
342         unsigned long InUnknownProtos6  __attribute__ ((aligned (8)));
343         unsigned long InTooBigErrors6   __attribute__ ((aligned (8)));
344         unsigned long InDiscards6       __attribute__ ((aligned (8)));
345         unsigned long OutDiscards6      __attribute__ ((aligned (8)));
346         unsigned long InNoRoutes6       __attribute__ ((aligned (8)));
347         unsigned long OutNoRoutes6      __attribute__ ((aligned (8)));
348         unsigned long ReasmFails6       __attribute__ ((aligned (8)));
349         unsigned long FragFails6        __attribute__ ((aligned (8)));
350         unsigned long InTruncatedPkts6  __attribute__ ((aligned (8)));
351 };
352
353 /* Structure stats_net_eip6 for ACTIVITY_MAGIC_BASE + 1 format */
354 struct stats_net_eip6_8b {
355         unsigned long long InHdrErrors6         __attribute__ ((aligned (16)));
356         unsigned long long InAddrErrors6        __attribute__ ((aligned (16)));
357         unsigned long long InUnknownProtos6     __attribute__ ((aligned (16)));
358         unsigned long long InTooBigErrors6      __attribute__ ((aligned (16)));
359         unsigned long long InDiscards6          __attribute__ ((aligned (16)));
360         unsigned long long OutDiscards6         __attribute__ ((aligned (16)));
361         unsigned long long InNoRoutes6          __attribute__ ((aligned (16)));
362         unsigned long long OutNoRoutes6         __attribute__ ((aligned (16)));
363         unsigned long long ReasmFails6          __attribute__ ((aligned (16)));
364         unsigned long long FragFails6           __attribute__ ((aligned (16)));
365         unsigned long long InTruncatedPkts6     __attribute__ ((aligned (16)));
366 };
367
368 /* Structure stats_huge for ACTIVITY_MAGIC_BASE */
369 struct stats_huge_8a {
370         unsigned long frhkb     __attribute__ ((aligned (8)));
371         unsigned long tlhkb     __attribute__ ((aligned (8)));
372 };
373
374 /* Structure stats_pwr_wghfreq for ACTIVITY_MAGIC_BASE */
375 struct stats_pwr_wghfreq_8a {
376         unsigned long long time_in_state        __attribute__ ((aligned (16)));
377         unsigned long      freq                 __attribute__ ((aligned (16)));
378 };
379
380 /* Structure stats_filesystem for ACTIVITY_MAGIC_BASE */
381 struct stats_filesystem_8a {
382         unsigned long long f_blocks             __attribute__ ((aligned (16)));
383         unsigned long long f_bfree              __attribute__ ((aligned (16)));
384         unsigned long long f_bavail             __attribute__ ((aligned (16)));
385         unsigned long long f_files              __attribute__ ((aligned (16)));
386         unsigned long long f_ffree              __attribute__ ((aligned (16)));
387         char               fs_name[MAX_FS_LEN]  __attribute__ ((aligned (16)));
388 #define STATS_FILESYSTEM_8A_1_SIZE      160
389         char               mountp[MAX_FS_LEN];
390 };
391
392 #endif  /* _SA_CONV_H */