]> granicus.if.org Git - sysstat/blob - sadf.h
sadf: Add new flag FO_LC_NUMERIC_C
[sysstat] / sadf.h
1 /*
2  * sadf: System activity data formatter
3  * (C) 1999-2019 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.7"
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 output should stop after the header is displayed.
54  */
55 #define FO_HEADER_ONLY          0x02
56
57 /*
58  * Indicate that a true sysstat activity file but with a bad
59  * format should not yield an error message.
60  */
61 #define FO_BAD_FILE_FORMAT      0x04
62
63 /*
64  * Indicate that timestamp can be displayed in local time instead of UTC
65  * if option -T or -t has been used.
66  */
67 #define FO_LOCAL_TIME           0x08
68
69 /*
70  * Indicate that all activities will be displayed horizontally
71  * if option -h is used.
72  */
73 #define FO_HORIZONTALLY         0x10
74
75 /*
76  * Indicate that the timestamp can be displayed in seconds since the epoch
77  * if option -U has been used.
78  */
79 #define FO_SEC_EPOCH            0x20
80
81 /*
82  * Indicate that the list of fields should be displayed before the first
83  * line of statistics.
84  */
85 #define FO_FIELD_LIST           0x40
86
87 /*
88  * Indicate that flag AO_CLOSE_MARKUP (set for activities that need it)
89  * should be taken into account for this output format.
90  */
91 #define FO_TEST_MARKUP          0x80
92
93 /*
94  * Indicate that timestamp cannot be displayed in the original local time
95  * of the data file creator.
96  */
97 #define FO_NO_TRUE_TIME         0x100
98
99 #define SET_LC_NUMERIC_C(m)             (((m) & FO_LC_NUMERIC_C)        == FO_LC_NUMERIC_C)
100 #define ACCEPT_HEADER_ONLY(m)           (((m) & FO_HEADER_ONLY)         == FO_HEADER_ONLY)
101 #define ACCEPT_BAD_FILE_FORMAT(m)       (((m) & FO_BAD_FILE_FORMAT)     == FO_BAD_FILE_FORMAT)
102 #define ACCEPT_LOCAL_TIME(m)            (((m) & FO_LOCAL_TIME)          == FO_LOCAL_TIME)
103 #define ACCEPT_HORIZONTALLY(m)          (((m) & FO_HORIZONTALLY)        == FO_HORIZONTALLY)
104 #define ACCEPT_SEC_EPOCH(m)             (((m) & FO_SEC_EPOCH)           == FO_SEC_EPOCH)
105 #define DISPLAY_FIELD_LIST(m)           (((m) & FO_FIELD_LIST)          == FO_FIELD_LIST)
106 #define TEST_MARKUP(m)                  (((m) & FO_TEST_MARKUP)         == FO_TEST_MARKUP)
107 #define REJECT_TRUE_TIME(m)             (((m) & FO_NO_TRUE_TIME)        == FO_NO_TRUE_TIME)
108
109
110 /*
111  ***************************************************************************
112  * Various function prototypes
113  ***************************************************************************
114  */
115
116 void convert_file
117         (char [], struct activity *[]);
118
119 /*
120  * Prototypes used to display restart messages
121  */
122 __printf_funct_t print_db_restart
123         (int *, int, char *, char *, int, struct file_header *);
124 __printf_funct_t print_ppc_restart
125         (int *, int, char *, char *, int, struct file_header *);
126 __printf_funct_t print_xml_restart
127         (int *, int, char *, char *, int, struct file_header *);
128 __printf_funct_t print_json_restart
129         (int *, int, char *, char *, int, struct file_header *);
130 __printf_funct_t print_raw_restart
131         (int *, int, char *, char *, int, struct file_header *);
132
133 /*
134  * Prototypes used to display comments
135  */
136 __printf_funct_t print_db_comment
137         (int *, int, char *, char *, int, char *, struct file_header *);
138 __printf_funct_t print_ppc_comment
139         (int *, int, char *, char *, int, char *, struct file_header *);
140 __printf_funct_t print_xml_comment
141         (int *, int, char *, char *, int, char *, struct file_header *);
142 __printf_funct_t print_json_comment
143         (int *, int, char *, char *, int, char *, struct file_header *);
144 __printf_funct_t print_sar_comment
145         (int *, int, char *, char *, int, char *, struct file_header *);
146 __printf_funct_t print_raw_comment
147         (int *, int, char *, char *, int, char *, struct file_header *);
148
149 /*
150  * Prototypes used to display the statistics part of the report
151  */
152 __printf_funct_t print_xml_statistics
153         (int *, int, struct activity * [], unsigned int []);
154 __printf_funct_t print_json_statistics
155         (int *, int, struct activity * [], unsigned int []);
156 __printf_funct_t print_pcp_statistics
157         (int *, int, struct activity * [], unsigned int []);
158
159 /*
160  * Prototypes used to display the timestamp part of the report
161  */
162 __tm_funct_t print_db_timestamp
163         (void *, int, char *, char *, unsigned long long,
164          struct record_header *, struct file_header *, unsigned int);
165 __tm_funct_t print_ppc_timestamp
166         (void *, int, char *, char *, unsigned long long,
167          struct record_header *, struct file_header *, unsigned int);
168 __tm_funct_t print_xml_timestamp
169         (void *, int, char *, char *, unsigned long long,
170          struct record_header *, struct file_header *, unsigned int);
171 __tm_funct_t print_json_timestamp
172         (void *, int, char *, char *, unsigned long long,
173          struct record_header *, struct file_header *, unsigned int);
174 __tm_funct_t print_raw_timestamp
175         (void *, int, char *, char *, unsigned long long,
176          struct record_header *, struct file_header *, unsigned int);
177 __tm_funct_t print_pcp_timestamp
178         (void *, int, char *, char *, unsigned long long,
179          struct record_header *, struct file_header *, unsigned int);
180
181 /*
182  * Prototypes used to display the report header
183  */
184 __printf_funct_t print_xml_header
185         (void *, int, char *, struct file_magic *, struct file_header *,
186          struct activity * [], unsigned int [], struct file_activity *);
187 __printf_funct_t print_json_header
188         (void *, int, char *, struct file_magic *, struct file_header *,
189          struct activity * [], unsigned int [], struct file_activity *);
190 __printf_funct_t print_hdr_header
191         (void *, int, char *, struct file_magic *, struct file_header *,
192          struct activity * [], unsigned int [], struct file_activity *);
193 __printf_funct_t print_svg_header
194         (void *, int, char *, struct file_magic *, struct file_header *,
195          struct activity * [], unsigned int [], struct file_activity *);
196 __printf_funct_t print_pcp_header
197         (void *, int, char *, struct file_magic *, struct file_header *,
198          struct activity * [], unsigned int [], struct file_activity *);
199
200 /*
201  * Main display functions
202  */
203 void logic1_display_loop
204         (int, char *, struct file_activity *, struct file_magic *,
205          struct tm *, struct tm *, void *);
206 void logic2_display_loop
207         (int, char *, struct file_activity *, struct file_magic *,
208          struct tm *, struct tm *, void *);
209 void svg_display_loop
210         (int, char *, struct file_activity *, struct file_magic *,
211          struct tm *, struct tm *, void *);
212
213 #endif  /* _SADF_H */