2 * FCP report generators
6 * Copyright IBM Corp. 2008
7 * Author(s): Stefan Raspl <raspl@linux.vnet.ibm.com>
10 #ifndef ZIOREP_UTILS_HPP
11 #define ZIOREP_UTILS_HPP
13 #include "ziorep_framer.hpp"
14 #include "ziorep_cfgreader.hpp"
15 #include "ziorep_printers.hpp"
16 #include "ziorep_collapser.hpp"
19 #include "ziomon_dacc.h"
23 #include <linux/types.h>
26 * Parse date provided in 'str' and store as seconds since 1970 in 'tgt'. */
27 int get_datetime_val(const char *str
, __u64
*tgt
);
31 * Print the provided value (seconds since 1970) in our common style. */
32 const char* print_time_formatted(__u64 timestamp
);
35 * Print the provided value (seconds since 1970) in our common style. */
36 const char* print_time_formatted_short(__u64 timestamp
);
39 * Adjust the timeframe to appropriate interval boundaries */
40 int adjust_timeframe(const char* filename
, __u64
*begin
, __u64
*end
,
45 * Add all present devices to the device filter */
46 int add_all_devices(ConfigReader
&cfg
, DeviceFilter
&dev_filt
);
50 * Utility function to retrieve a list of all devices that we have data for.
51 * Result is put into 'dev_filt'.
53 int get_all_devices(const char *filename
, DeviceFilter
&dev_filt
,
57 * Run over frames and print each one.
58 * Returns <0 in case of error and number of frames printed otherwise.
60 int print_report(FILE *fp
, __u64 begin
, __u64 end
,
62 char *filename
, __u64 topline
,
63 list
<MsgTypes
> *filter_types
,
64 DeviceFilter
&dev_filter
, Collapser
&col
,
68 * Print summary of available data.
69 * 'fp' is the file to write all output to, 'filename' the standard
71 * Returns number of characters printed.
73 int print_summary_report(FILE *fp
, char *filename
, ConfigReader
&cfg
);
77 * Minor help function to parse a string into a __u64 and check
79 int parse_topline_arg(char *str
, __u64
*arg
);
81 FILE* open_csv_output_file(const char *filename
, const char *extension
,