2 * format.c: Output format definitions for sadf and sar
3 * (C) 2011-2022 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
31 ***************************************************************************
32 * Definitions of output formats.
33 * See sadf.h file for format structure definition.
34 ***************************************************************************
39 * Display only datafile header.
41 struct report_format hdr_fmt = {
42 .id = F_HEADER_OUTPUT,
43 .options = FO_HEADER_ONLY,
44 .f_header = print_hdr_header,
53 * Database friendly format.
55 struct report_format db_fmt = {
57 .options = FO_LOCAL_TIME + FO_HORIZONTALLY +
58 FO_SEC_EPOCH + FO_FIELD_LIST,
61 .f_timestamp = print_db_timestamp,
62 .f_restart = print_db_restart,
63 .f_comment = print_db_comment,
64 .f_display = logic2_display_loop
68 * Format easily handled by pattern processing commands like awk.
70 struct report_format ppc_fmt = {
72 .options = FO_LOCAL_TIME + FO_SEC_EPOCH,
75 .f_timestamp = print_ppc_timestamp,
76 .f_restart = print_ppc_restart,
77 .f_comment = print_ppc_comment,
78 .f_display = logic2_display_loop
84 struct report_format xml_fmt = {
86 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP,
87 .f_header = print_xml_header,
88 .f_statistics = print_xml_statistics,
89 .f_timestamp = print_xml_timestamp,
90 .f_restart = print_xml_restart,
91 .f_comment = print_xml_comment,
92 .f_display = logic1_display_loop
98 struct report_format json_fmt = {
100 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP +
102 .f_header = print_json_header,
103 .f_statistics = print_json_statistics,
104 .f_timestamp = print_json_timestamp,
105 .f_restart = print_json_restart,
106 .f_comment = print_json_comment,
107 .f_display = logic1_display_loop
111 * Convert an old datafile to up-to-date format.
113 struct report_format conv_fmt = {
117 .f_statistics = NULL,
127 struct report_format svg_fmt = {
129 .options = FO_HEADER_ONLY + FO_LOCAL_TIME +
131 .f_header = print_svg_header,
132 .f_statistics = NULL,
136 .f_display = svg_display_loop
142 struct report_format raw_fmt = {
144 .options = FO_LOCAL_TIME + FO_SEC_EPOCH,
146 .f_statistics = NULL,
147 .f_timestamp = print_raw_timestamp,
148 .f_restart = print_raw_restart,
149 .f_comment = print_raw_comment,
150 .f_display = logic2_display_loop
156 struct report_format pcp_fmt = {
158 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_NO_TRUE_TIME +
159 FO_ITEM_LIST + FO_FULL_ORDER,
160 .f_header = print_pcp_header,
161 .f_statistics = print_pcp_statistics,
162 .f_timestamp = print_pcp_timestamp,
163 .f_restart = print_pcp_restart,
164 .f_comment = print_pcp_comment,
165 .f_display = logic1_display_loop
169 * Array of output formats.
171 struct report_format *fmt[NR_FMT] = {
186 * Special output format for sar.
187 * Used only for functions to display special
188 * (RESTART and COMMENT) records.
190 struct report_format sar_fmt = {
194 .f_statistics = NULL,
196 .f_restart = print_sar_restart,
197 .f_comment = print_sar_comment