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