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