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