Import version 1.8.3
[s390-tools.git] / ziomon / ziorep_framer.hpp
blob573a4169703bbf3665b445e52e352b5c46f19311
1 /*
2 * FCP report generators
4 * Class for reading messages into frames.
6 * Copyright IBM Corp. 2008
7 * Author(s): Stefan Raspl <raspl@linux.vnet.ibm.com>
8 */
10 #ifndef ZIOREP_FRAMER
11 #define ZIOREP_FRAMER
13 #include <list>
15 #include "ziorep_filters.hpp"
16 #include "ziorep_frameset.hpp"
19 using std::list;
22 extern "C" {
23 #include "ziomon_dacc.h"
27 class Framer {
28 public:
29 /**
30 * Note: Filter parameters transfer memory ownership to class.
31 * 'filter_types' is an optional list of message types that should
32 * be processed exclusively, anything else will be ignored. If not set,
33 * all messages will be processed.
35 Framer(__u64 begin, __u64 end, __u32 interval_length,
36 list<MsgTypes> *filter_types, DeviceFilter *devFilter,
37 const char *filename, int *rc);
39 ~Framer();
41 /**
42 * Retrieve the next set of messages.
43 * Returns 0 in case of success, <0 in case of failure
44 * and >0 in case end of data has been reached.
45 * Set 'replace_missing' to fill in for non-present datasets.
46 * E.g. if no utilization data was found in the interval (since there
47 * was no traffic), a dataset with the expected number of samples
48 * (but all 0s for the values) will be generated.
50 int get_next_frameset(Frameset &frameset, bool replace_missing = false);
52 private:
53 void handle_msg(struct message *msg, Frameset &frameset) const;
54 bool handle_agg_data(Frameset &frameset) const;
56 /* timestamps of samples to consider
57 * These are exact timestamps, we shift them a bit to make sure that
58 * we catch any late or early messages as well */
59 __u64 m_begin;
60 __u64 m_end;
61 /// user-specified interval length
62 __u32 m_interval_length;
64 /* Criteria to identify the right messages */
65 MsgTypeFilter *m_type_filter;
66 DeviceFilter *m_device_filter;
68 // filename without extension
69 const char *m_filename;
70 FILE *m_fp;
71 struct file_header m_fhdr;
72 struct aggr_data *m_agg_data;
73 /// indicates whether the .agg file was already read or not
74 bool m_agg_read;
78 #endif