]> granicus.if.org Git - sysstat/blob - sadf.h
SVG: Fix how bar graphs are displayed for fs statistics
[sysstat] / sadf.h
1 /*
2  * sadf: System activity data formatter
3  * (C) 1999-2016 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.1"
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_VOLATILE      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  7
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
42 /* Format options */
43
44 /*
45  * Indicate that all statistics data for one activity should be displayed before
46  * displaying stats for next activity. This is what sar does in its report.
47  * Example: If stats for activities A and B at time t and t' have been collected,
48  * setting AO_GROUPED_STATS for a format will result in the following output:
49  * stats for activity A at t
50  * stats for activity A at t'
51  * stats for activity B at t
52  * stats for activity B at t'
53  * Without this option, output would be:
54  * stats for activity A at t
55  * stats for activity B at t
56  * stats for activity A at t'
57  * stats for activity B at t'
58  */
59 #define FO_GROUPED_STATS        0x01
60
61 /*
62  * Indicate that output should stop after the header is displayed.
63  */
64 #define FO_HEADER_ONLY          0x02
65
66 /*
67  * Indicate that a true sysstat activity file but with a bad
68  * format should not yield an error message.
69  */
70 #define FO_BAD_FILE_FORMAT      0x04
71
72 /*
73  * Indicate that timestamp can be displayed in local time instead of UTC
74  * if option -T or -t has been used.
75  */
76 #define FO_LOCAL_TIME           0x08
77
78 /*
79  * Indicate that all activities will be displayed horizontally
80  * if option -h is used.
81  */
82 #define FO_HORIZONTALLY         0x10
83
84 /*
85  * Indicate that the timestamp can be displayed in seconds since the epoch
86  * if option -U has been used.
87  */
88 #define FO_SEC_EPOCH            0x20
89
90 /*
91  * Indicate that the list of fields should be displayed before the first
92  * line of statistics.
93  */
94 #define FO_FIELD_LIST           0x40
95
96 /*
97  * Indicate that flag AO_CLOSE_MARKUP (set for activities that need it)
98  * should be taken into account for this output format.
99  */
100 #define FO_TEST_MARKUP          0x80
101
102 /*
103  * Indicate that timestamp cannot be displayed in the original local time
104  * of the data file creator.
105  */
106 #define FO_NO_TRUE_TIME         0x100
107
108 #define DISPLAY_GROUPED_STATS(m)        (((m) & FO_GROUPED_STATS)       == FO_GROUPED_STATS)
109 #define ACCEPT_HEADER_ONLY(m)           (((m) & FO_HEADER_ONLY)         == FO_HEADER_ONLY)
110 #define ACCEPT_BAD_FILE_FORMAT(m)       (((m) & FO_BAD_FILE_FORMAT)     == FO_BAD_FILE_FORMAT)
111 #define ACCEPT_LOCAL_TIME(m)            (((m) & FO_LOCAL_TIME)          == FO_LOCAL_TIME)
112 #define ACCEPT_HORIZONTALLY(m)          (((m) & FO_HORIZONTALLY)        == FO_HORIZONTALLY)
113 #define ACCEPT_SEC_EPOCH(m)             (((m) & FO_SEC_EPOCH)           == FO_SEC_EPOCH)
114 #define DISPLAY_FIELD_LIST(m)           (((m) & FO_FIELD_LIST)          == FO_FIELD_LIST)
115 #define TEST_MARKUP(m)                  (((m) & FO_TEST_MARKUP)         == FO_TEST_MARKUP)
116 #define REJECT_TRUE_TIME(m)             (((m) & FO_NO_TRUE_TIME)        == FO_NO_TRUE_TIME)
117
118
119 /*
120  ***************************************************************************
121  * Various function prototypes
122  ***************************************************************************
123  */
124
125 void convert_file
126         (char [], struct activity *[]);
127 void xprintf
128         (int, const char *, ...);
129 void xprintf0
130         (int, const char *, ...);
131
132 /*
133  * Prototypes used to display restart messages
134  */
135 __printf_funct_t print_db_restart
136         (int *, int, char *, char *, int, struct file_header *, unsigned int);
137 __printf_funct_t print_ppc_restart
138         (int *, int, char *, char *, int, struct file_header *, unsigned int);
139 __printf_funct_t print_xml_restart
140         (int *, int, char *, char *, int, struct file_header *, unsigned int);
141 __printf_funct_t print_json_restart
142         (int *, int, char *, char *, int, struct file_header *, unsigned int);
143 __printf_funct_t print_sar_restart
144         (int *, int, char *, char *, int, struct file_header *, unsigned int);
145
146 /*
147  * Prototypes used to display comments
148  */
149 __printf_funct_t print_db_comment
150         (int *, int, char *, char *, int, char *, struct file_header *);
151 __printf_funct_t print_ppc_comment
152         (int *, int, char *, char *, int, char *, struct file_header *);
153 __printf_funct_t print_xml_comment
154         (int *, int, char *, char *, int, char *, struct file_header *);
155 __printf_funct_t print_json_comment
156         (int *, int, char *, char *, int, char *, struct file_header *);
157 __printf_funct_t print_sar_comment
158         (int *, int, char *, char *, int, char *, struct file_header *);
159
160 /*
161  * Prototypes used to display the statistics part of the report
162  */
163 __printf_funct_t print_xml_statistics
164         (int *, int);
165 __printf_funct_t print_json_statistics
166         (int *, int);
167
168 /*
169  * Prototypes used to display the timestamp part of the report
170  */
171 __tm_funct_t print_db_timestamp
172         (void *, int, char *, char *, unsigned long long, struct file_header *, unsigned int);
173 __tm_funct_t print_ppc_timestamp
174         (void *, int, char *, char *, unsigned long long, struct file_header *, unsigned int);
175 __tm_funct_t print_xml_timestamp
176         (void *, int, char *, char *, unsigned long long, struct file_header *, unsigned int);
177 __tm_funct_t print_json_timestamp
178         (void *, int, char *, char *, unsigned long long, struct file_header *, unsigned int);
179
180 /*
181  * Prototypes used to display the report header
182  */
183 __printf_funct_t print_xml_header
184         (void *, int, char *, struct file_magic *, struct file_header *,
185          __nr_t, struct activity * [], unsigned int []);
186 __printf_funct_t print_json_header
187         (void *, int, char *, struct file_magic *, struct file_header *,
188          __nr_t, struct activity * [], unsigned int []);
189 __printf_funct_t print_hdr_header
190         (void *, int, char *, struct file_magic *, struct file_header *,
191          __nr_t, struct activity * [], unsigned int []);
192 __printf_funct_t print_svg_header
193         (void *, int, char *, struct file_magic *, struct file_header *,
194          __nr_t, struct activity * [], unsigned int []);
195
196 #endif  /* _SADF_H */