]> granicus.if.org Git - sysstat/blob - sadf.h
Remove unused constants from header files
[sysstat] / sadf.h
1 /*
2  * sadf: System activity data formatter
3  * (C) 1999-2012 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 "2.15"
13
14 /* Possible actions for functions used to display reports */
15 #define F_BEGIN 0x01
16 #define F_MAIN  0x02
17 #define F_END   0x04
18
19 /*
20  ***************************************************************************
21  * Output format identification values.
22  ***************************************************************************
23  */
24
25 /* Number of output formats */
26 #define NR_FMT  5
27
28 /* Output formats */
29 #define F_DB_OUTPUT     1
30 #define F_HEADER_OUTPUT 2
31 #define F_PPC_OUTPUT    3
32 #define F_XML_OUTPUT    4
33 #define F_JSON_OUTPUT   5
34
35 /*
36  ***************************************************************************
37  * Generic description of an output format.
38  ***************************************************************************
39  */
40
41 /* Format options */
42
43 /*
44  * Indicate that all statistics data for one activity should be displayed before
45  * displaying stats for next activity. This is what sar does in its report.
46  * Example: If stats for activities A and B at time t and t' have been collected,
47  * setting AO_GROUPED_STATS for a format will result in the following output:
48  * stats for activity A at t
49  * stats for activity A at t'
50  * stats for activity B at t
51  * stats for activity B at t'
52  * Without this option, output would be:
53  * stats for activity A at t
54  * stats for activity B at t
55  * stats for activity A at t'
56  * stats for activity B at t'
57  */
58 #define FO_GROUPED_STATS        0x01
59
60 /*
61  * Indicate that output should stop after the header is displayed.
62  */
63 #define FO_HEADER_ONLY          0x02
64
65 /*
66  * Indicate that a true sysstat activity file but with a bad
67  * format should not yield an error message.
68  */
69 #define FO_BAD_FILE_FORMAT      0x04
70
71 /*
72  * Indicate that timestamp can be displayed in local time instead of UTC
73  * if option -T or -t has been used.
74  */
75 #define FO_LOCAL_TIME           0x08
76
77 /*
78  * Indicate that all activities will be displayed horizontally
79  * if option -h is used.
80  */
81 #define FO_HORIZONTALLY         0x10
82
83 /*
84  * Indicate that the timestamp can be displayed in seconds since the epoch
85  * if option -U has been used.
86  */
87 #define FO_SEC_EPOCH            0x20
88
89 /*
90  * Indicate that the list of fields should be displayed before the first
91  * line of statistics.
92  */
93 #define FO_FIELD_LIST           0x40
94
95 #define DISPLAY_GROUPED_STATS(m)        (((m) & FO_GROUPED_STATS)       == FO_GROUPED_STATS)
96 #define ACCEPT_HEADER_ONLY(m)           (((m) & FO_HEADER_ONLY)         == FO_HEADER_ONLY)
97 #define ACCEPT_BAD_FILE_FORMAT(m)       (((m) & FO_BAD_FILE_FORMAT)     == FO_BAD_FILE_FORMAT)
98 #define ACCEPT_LOCAL_TIME(m)            (((m) & FO_LOCAL_TIME)          == FO_LOCAL_TIME)
99 #define ACCEPT_HORIZONTALLY(m)          (((m) & FO_HORIZONTALLY)        == FO_HORIZONTALLY)
100 #define ACCEPT_SEC_EPOCH(m)             (((m) & FO_SEC_EPOCH)           == FO_SEC_EPOCH)
101 #define DISPLAY_FIELD_LIST(m)           (((m) & FO_FIELD_LIST)          == FO_FIELD_LIST)
102
103 /* Type for all functions used by sadf to display stats in various formats */
104 #define __printf_funct_t void
105
106 /*
107  * Structure used to define a report.
108  * A XML-like report has the following format:
109  *       __
110  *      |
111  *      | Header block
112  *      |  __
113  *      | |
114  *      | | Statistics block
115  *      | |  __
116  *      | | |
117  *      | | | Timestamp block
118  *      | | |  __
119  *      | | | |
120  *      | | | | Activity #1
121  *      | | | |__
122  *      | | | |
123  *      | | | | ...
124  *      | | | |__
125  *      | | | |
126  *      | | | | Activity #n
127  *      | | | |__
128  *      | | |__
129  *      | |__
130  *      | |
131  *      | | Restart messages block
132  *      | |__
133  *      | |
134  *      | | Comments block
135  *      | |__
136  *      |__
137  */
138 struct report_format {
139         /*
140          * This variable contains the identification value (F_...) for this report format.
141          */
142         unsigned int id;
143         /*
144          * Format options (FO_...).
145          */
146         unsigned int options;
147         /*
148          * This function displays the report header
149          * (data displayed once at the beginning of the report).
150          */
151         __printf_funct_t (*f_header) (int *, int, char *, struct file_magic *, struct file_header *,
152                                       __nr_t, struct activity * [], unsigned int []);
153         /*
154          * This function defines the statistics part of the report.
155          * Used only with textual (XML-like) reports.
156          */
157         __printf_funct_t (*f_statistics) (int *, int);
158         /*
159          * This function defines the timestamp part of the report.
160          * Used only with textual (XML-like) reports.
161          */
162         __printf_funct_t (*f_timestamp) (int *, int, char *, char *, int, unsigned long long);
163         /*
164          * This function displays the restart messages.
165          */
166         __printf_funct_t (*f_restart) (int *, int, char *, char *, int, struct file_header *);
167         /*
168          * This function displays the comments.
169          */
170         __printf_funct_t (*f_comment) (int *, int, char *, char *, int, char *, struct file_header *);
171 };
172
173 /*
174  ***************************************************************************
175  * Various function prototypes
176  ***************************************************************************
177  */
178
179 extern void
180         xprintf(int, const char *, ...);
181 extern void
182         xprintf0(int, const char *, ...);
183
184 /*
185  * Prototypes used to display restart messages
186  */
187 __printf_funct_t
188         print_db_restart(int *, int, char *, char *, int, struct file_header *);
189 __printf_funct_t
190         print_ppc_restart(int *, int, char *, char *, int, struct file_header *);
191 __printf_funct_t
192         print_xml_restart(int *, int, char *, char *, int, struct file_header *);
193 __printf_funct_t
194         print_json_restart(int *, int, char *, char *, int, struct file_header *);
195
196 /*
197  * Prototypes used to display comments
198  */
199 __printf_funct_t
200         print_db_comment(int *, int, char *, char *, int, char *, struct file_header *);
201 __printf_funct_t
202         print_ppc_comment(int *, int, char *, char *, int, char *, struct file_header *);
203 __printf_funct_t
204         print_xml_comment(int *, int, char *, char *, int, char *, struct file_header *);
205 __printf_funct_t
206         print_json_comment(int *, int, char *, char *, int, char *, struct file_header *);
207
208 /*
209  * Prototypes used to display the statistics part of the report
210  */
211 __printf_funct_t
212         print_xml_statistics(int *, int);
213 __printf_funct_t
214         print_json_statistics(int *, int);
215
216 /*
217  * Prototypes used to display the timestamp part of the report
218  */
219 __printf_funct_t
220         print_xml_timestamp(int *, int, char *, char *, int, unsigned long long);
221 __printf_funct_t
222         print_json_timestamp(int *, int, char *, char *, int, unsigned long long);
223
224 /*
225  * Prototypes used to display the report header
226  */
227 __printf_funct_t
228         print_xml_header(int *, int, char *, struct file_magic *, struct file_header *,
229                          __nr_t, struct activity * [], unsigned int []);
230 __printf_funct_t
231         print_json_header(int *, int, char *, struct file_magic *, struct file_header *,
232                           __nr_t, struct activity * [], unsigned int []);
233 __printf_funct_t
234         print_hdr_header(int *, int, char *, struct file_magic *, struct file_header *,
235                          __nr_t, struct activity * [], unsigned int []);
236
237 #endif  /* _SADF_H */