2 * sadf: System activity data formatter
3 * (C) 1999-2021 by Sebastien Godard (sysstat <at> orange.fr)
11 /* DTD version for XML output */
12 #define XML_DTD_VERSION "3.9"
14 /* Various constants */
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
25 ***************************************************************************
26 * Output format identification values.
27 ***************************************************************************
31 * Indicate that a decimal point should be used to make output
34 #define FO_LC_NUMERIC_C 0x01
37 * Indicate that option -H may be used with corresponding format
38 * so that only the header is displayed.
40 #define FO_HEADER_ONLY 0x02
45 * Indicate that timestamp can be displayed in local time instead of UTC
46 * if option -T or -t has been used.
48 #define FO_LOCAL_TIME 0x08
51 * Indicate that all activities will be displayed horizontally
52 * if option -h is used.
54 #define FO_HORIZONTALLY 0x10
57 * Indicate that the timestamp can be displayed in seconds since the epoch
58 * if option -U has been used.
60 #define FO_SEC_EPOCH 0x20
63 * Indicate that the list of fields should be displayed before the first
66 #define FO_FIELD_LIST 0x40
69 * Indicate that flag AO_CLOSE_MARKUP (set for activities that need it)
70 * should be taken into account for this output format.
72 #define FO_TEST_MARKUP 0x80
75 * Indicate that timestamp cannot be displayed in the original local time
76 * of the data file creator.
78 #define FO_NO_TRUE_TIME 0x100
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).
84 #define FO_ITEM_LIST 0x200
87 * Indicate that all the records, including RESTART and COMMENT ones,
88 * should be displayed in order of time.
90 #define FO_FULL_ORDER 0x400
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)
105 ***************************************************************************
106 * Various function prototypes
107 ***************************************************************************
111 (char [], struct activity *[]);
114 * Prototypes used to display restart messages
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 *);
130 * Prototypes used to display comments
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 *);
148 * Prototypes used to display the statistics part of the report
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 []);
158 * Prototypes used to display the timestamp part of the report
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);
180 * Prototypes used to display the report header
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 *);
199 * Main display functions
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 *);