]> granicus.if.org Git - sysstat/blob - sadf.h
sadf: Make 'debug' option independent from RAW output format
[sysstat] / sadf.h
1 /*
2  * sadf: System activity data formatter
3  * (C) 1999-2020 by Sebastien Godard (sysstat <at> orange.fr)
4  */
5
6 #ifndef _SADF_H
7 #define _SADF_H
8
9 #include "sa.h"
10
11 /* DTD version for XML output */
12 #define XML_DTD_VERSION "3.9"
13
14 /* Various constants */
15 #define DO_SAVE         0
16 #define DO_RESTORE      1
17
18 #define IGNORE_NOTHING          0
19 #define IGNORE_RESTART          1
20 #define DONT_READ_CPU_NR        2
21 #define IGNORE_COMMENT          4
22 #define SET_TIMESTAMPS          8
23
24 /*
25  ***************************************************************************
26  * Output format identification values.
27  ***************************************************************************
28  */
29
30 /*
31  * Indicate that a decimal point should be used to make output
32  * locale independent.
33  */
34 #define FO_LC_NUMERIC_C         0x01
35
36 /*
37  * Indicate that option -H may be used with corresponding format
38  * so that only the header is displayed.
39  */
40 #define FO_HEADER_ONLY          0x02
41
42 /* Unused: 0x04 */
43
44 /*
45  * Indicate that timestamp can be displayed in local time instead of UTC
46  * if option -T or -t has been used.
47  */
48 #define FO_LOCAL_TIME           0x08
49
50 /*
51  * Indicate that all activities will be displayed horizontally
52  * if option -h is used.
53  */
54 #define FO_HORIZONTALLY         0x10
55
56 /*
57  * Indicate that the timestamp can be displayed in seconds since the epoch
58  * if option -U has been used.
59  */
60 #define FO_SEC_EPOCH            0x20
61
62 /*
63  * Indicate that the list of fields should be displayed before the first
64  * line of statistics.
65  */
66 #define FO_FIELD_LIST           0x40
67
68 /*
69  * Indicate that flag AO_CLOSE_MARKUP (set for activities that need it)
70  * should be taken into account for this output format.
71  */
72 #define FO_TEST_MARKUP          0x80
73
74 /*
75  * Indicate that timestamp cannot be displayed in the original local time
76  * of the data file creator.
77  */
78 #define FO_NO_TRUE_TIME         0x100
79
80 /*
81  * Indicate that the number of different items should be counted and
82  * a list created (see @item_list and @item_list_sz in struct activity).
83  */
84 #define FO_ITEM_LIST            0x200
85
86 /*
87  * Indicate that all the records, including RESTART and COMMENT ones,
88  * should be displayed in order of time.
89  */
90 #define FO_FULL_ORDER           0x400
91
92 #define SET_LC_NUMERIC_C(m)             (((m) & FO_LC_NUMERIC_C)        == FO_LC_NUMERIC_C)
93 #define ACCEPT_HEADER_ONLY(m)           (((m) & FO_HEADER_ONLY)         == FO_HEADER_ONLY)
94 #define ACCEPT_LOCAL_TIME(m)            (((m) & FO_LOCAL_TIME)          == FO_LOCAL_TIME)
95 #define ACCEPT_HORIZONTALLY(m)          (((m) & FO_HORIZONTALLY)        == FO_HORIZONTALLY)
96 #define ACCEPT_SEC_EPOCH(m)             (((m) & FO_SEC_EPOCH)           == FO_SEC_EPOCH)
97 #define DISPLAY_FIELD_LIST(m)           (((m) & FO_FIELD_LIST)          == FO_FIELD_LIST)
98 #define TEST_MARKUP(m)                  (((m) & FO_TEST_MARKUP)         == FO_TEST_MARKUP)
99 #define REJECT_TRUE_TIME(m)             (((m) & FO_NO_TRUE_TIME)        == FO_NO_TRUE_TIME)
100 #define CREATE_ITEM_LIST(m)             (((m) & FO_ITEM_LIST)           == FO_ITEM_LIST)
101 #define ORDER_ALL_RECORDS(m)            (((m) & FO_FULL_ORDER)          == FO_FULL_ORDER)
102
103
104 /*
105  ***************************************************************************
106  * Various function prototypes
107  ***************************************************************************
108  */
109
110 void convert_file
111         (char [], struct activity *[]);
112
113 /*
114  * Prototypes used to display restart messages
115  */
116 __printf_funct_t print_db_restart
117         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
118 __printf_funct_t print_ppc_restart
119         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
120 __printf_funct_t print_xml_restart
121         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
122 __printf_funct_t print_json_restart
123         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
124 __printf_funct_t print_raw_restart
125         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
126 __printf_funct_t print_pcp_restart
127         (int *, int, char *, char *, int, struct file_header *, struct record_header *);
128
129 /*
130  * Prototypes used to display comments
131  */
132 __printf_funct_t print_db_comment
133         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
134 __printf_funct_t print_ppc_comment
135         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
136 __printf_funct_t print_xml_comment
137         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
138 __printf_funct_t print_json_comment
139         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
140 __printf_funct_t print_sar_comment
141         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
142 __printf_funct_t print_raw_comment
143         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
144 __printf_funct_t print_pcp_comment
145         (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *);
146
147 /*
148  * Prototypes used to display the statistics part of the report
149  */
150 __printf_funct_t print_xml_statistics
151         (int *, int, struct activity * [], unsigned int []);
152 __printf_funct_t print_json_statistics
153         (int *, int, struct activity * [], unsigned int []);
154 __printf_funct_t print_pcp_statistics
155         (int *, int, struct activity * [], unsigned int []);
156
157 /*
158  * Prototypes used to display the timestamp part of the report
159  */
160 __tm_funct_t print_db_timestamp
161         (void *, int, char *, char *, unsigned long long,
162          struct record_header *, struct file_header *, unsigned int);
163 __tm_funct_t print_ppc_timestamp
164         (void *, int, char *, char *, unsigned long long,
165          struct record_header *, struct file_header *, unsigned int);
166 __tm_funct_t print_xml_timestamp
167         (void *, int, char *, char *, unsigned long long,
168          struct record_header *, struct file_header *, unsigned int);
169 __tm_funct_t print_json_timestamp
170         (void *, int, char *, char *, unsigned long long,
171          struct record_header *, struct file_header *, unsigned int);
172 __tm_funct_t print_raw_timestamp
173         (void *, int, char *, char *, unsigned long long,
174          struct record_header *, struct file_header *, unsigned int);
175 __tm_funct_t print_pcp_timestamp
176         (void *, int, char *, char *, unsigned long long,
177          struct record_header *, struct file_header *, unsigned int);
178
179 /*
180  * Prototypes used to display the report header
181  */
182 __printf_funct_t print_xml_header
183         (void *, int, char *, struct file_magic *, struct file_header *,
184          struct activity * [], unsigned int [], struct file_activity *);
185 __printf_funct_t print_json_header
186         (void *, int, char *, struct file_magic *, struct file_header *,
187          struct activity * [], unsigned int [], struct file_activity *);
188 __printf_funct_t print_hdr_header
189         (void *, int, char *, struct file_magic *, struct file_header *,
190          struct activity * [], unsigned int [], struct file_activity *);
191 __printf_funct_t print_svg_header
192         (void *, int, char *, struct file_magic *, struct file_header *,
193          struct activity * [], unsigned int [], struct file_activity *);
194 __printf_funct_t print_pcp_header
195         (void *, int, char *, struct file_magic *, struct file_header *,
196          struct activity * [], unsigned int [], struct file_activity *);
197
198 /*
199  * Main display functions
200  */
201 void logic1_display_loop
202         (int, char *, struct file_activity *, struct file_magic *,
203          struct tm *, void *);
204 void logic2_display_loop
205         (int, char *, struct file_activity *, struct file_magic *,
206          struct tm *, void *);
207 void svg_display_loop
208         (int, char *, struct file_activity *, struct file_magic *,
209          struct tm *, void *);
210
211 #endif  /* _SADF_H */