00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00032
#ifndef __MEASURE_CONFIGURATION_H
00033
#define __MEASURE_CONFIGURATION_H
00034
00035
#include <config.h>
00036
#include <object.h>
00037
#include <measure.h>
00038
00039
#include <set>
00040
#include <map>
00041
#include <vector>
00042
00043
#include <iostream>
00044
#include <fstream>
00045
#include <string>
00046
#include <cstdlib>
00047
00049 struct MetricDescAvg {
00050
public:
00052 bool relevant;
00054 bool output;
00056 bool check;
00058 double outCL;
00060 double CL;
00062 double threshold;
00063
00065 MetricDescAvg () :
00066
relevant (false),
output (false),
check (false) { }
00068 bool isRelevant ()
const {
return relevant; }
00069 };
00070
00072 struct MetricDescDst {
00073
public:
00075 MetricDescAvg pmf;
00077 MetricDescAvg cdf;
00079 MetricDescAvg mean;
00081 MetricDescAvg median;
00083 MetricDescAvg percentile95;
00085 MetricDescAvg percentile99;
00086
00088 MetricDescDst () { }
00090 bool isRelevant ()
const {
00091
if (
pmf.
relevant ==
true ||
cdf.
relevant ==
true ||
00092
mean.
relevant ==
true ||
median.
relevant ==
true ||
00093
percentile95.
relevant ==
true ||
percentile99.
relevant ==
true )
00094
return true;
00095
return false;
00096 }
00097 };
00098
00100 class Configuration :
public Object {
00102 std::string
outputFileName;
00104 unsigned int minReplics;
00106 unsigned int maxReplics;
00108 std::string
headerName;
00110 std::string
trailerName;
00112 std::map< std::string, std::vector<MetricDescAvg> >
avg;
00114 std::map< std::string, std::vector<MetricDescDst> >
dst;
00115
00117
00120
void insert (std::string s,
unsigned int id,
const MetricDescAvg& dsc);
00122
00126
void insert (std::string s,
unsigned int id,
00127 std::string what,
const MetricDescAvg& dsc);
00128
00130
00136 std::string
getNextWord (std::istream& is,
bool required =
false);
00137
public:
00139 Configuration () :
Object ("
Configuration"),
minReplics(0),
maxReplics(0) { }
00141 ~Configuration () { }
00142
00144
void parse (std::string inputFileName);
00145
00147 std::string
getOutputFileName ()
const {
return outputFileName; }
00149 unsigned int getMinReplics ()
const {
return minReplics; }
00151 unsigned int getMaxReplics ()
const {
return maxReplics; }
00153 std::string
getHeaderName ()
const {
return headerName; }
00155 std::string
getTrailerName ()
const {
return trailerName; }
00157 void getDescAvg (
00158
bool& valid,
MetricDescAvg& dsc,
00159 std::string s,
unsigned int id) {
00160
if (
avg.count (s) == 0 ||
id >=
avg[s].size() ) valid =
false;
00161
else { valid =
true; dsc = avg[s][
id]; } }
00163 void getDescDst (
00164
bool& valid,
MetricDescDst& dsc,
00165 std::string s,
unsigned int id) {
00166
if (
dst.count (s) == 0 ||
id >=
dst[s].size() ) valid =
false;
00167
else { valid =
true; dsc = dst[s][
id]; } }
00168
00170
void dump (std::ostream& os);
00171 };
00172
00173
#endif // __MEASURE_CONFIGURATION_H