2 * format.c: Output format definitions for sadf and sar
3 * (C) 2011-2018 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 + FO_BAD_FILE_FORMAT,
44 .f_header = print_hdr_header,
52 * Database friendly format.
54 struct report_format db_fmt = {
56 .options = FO_GROUPED_STATS + FO_LOCAL_TIME + FO_HORIZONTALLY +
57 FO_SEC_EPOCH + FO_FIELD_LIST,
60 .f_timestamp = print_db_timestamp,
61 .f_restart = print_db_restart,
62 .f_comment = print_db_comment
66 * Format easily handled by pattern processing commands like awk.
68 struct report_format ppc_fmt = {
70 .options = FO_GROUPED_STATS + FO_LOCAL_TIME + FO_SEC_EPOCH,
73 .f_timestamp = print_ppc_timestamp,
74 .f_restart = print_ppc_restart,
75 .f_comment = print_ppc_comment
81 struct report_format xml_fmt = {
83 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP,
84 .f_header = print_xml_header,
85 .f_statistics = print_xml_statistics,
86 .f_timestamp = print_xml_timestamp,
87 .f_restart = print_xml_restart,
88 .f_comment = print_xml_comment
94 struct report_format json_fmt = {
96 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP,
97 .f_header = print_json_header,
98 .f_statistics = print_json_statistics,
99 .f_timestamp = print_json_timestamp,
100 .f_restart = print_json_restart,
101 .f_comment = print_json_comment
105 * Convert an old datafile to up-to-date format.
107 struct report_format conv_fmt = {
109 .options = FO_BAD_FILE_FORMAT,
111 .f_statistics = NULL,
120 struct report_format svg_fmt = {
122 .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_NO_TRUE_TIME,
123 .f_header = print_svg_header,
124 .f_statistics = NULL,
133 struct report_format raw_fmt = {
135 .options = FO_GROUPED_STATS + FO_LOCAL_TIME + FO_SEC_EPOCH,
137 .f_statistics = NULL,
138 .f_timestamp = print_raw_timestamp,
139 .f_restart = print_raw_restart,
140 .f_comment = print_raw_comment
144 * Array of output formats.
146 struct report_format *fmt[NR_FMT] = {
160 * Special output format for sar.
161 * Used only for functions to display special
162 * (RESTART and COMMENT) records.
164 struct report_format sar_fmt = {
168 .f_statistics = NULL,
170 .f_restart = print_sar_restart,
171 .f_comment = print_sar_comment