00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00032
#ifndef __MEASURE_MEASURE_H
00033
#define __MEASURE_MEASURE_H
00034
00035
#include <config.h>
00036
#include <stat.h>
00037
00038
#include <iostream>
00039
#include <vector>
00040
#include <string>
00041
#include <map>
00042
00044 class Population {
00046 std::vector<sample_t>
population;
00047
public:
00049 Population () { }
00051 ~Population () { }
00052
00054 unsigned int getSize ()
const {
return population.size(); }
00056
void addSample (sample_t x);
00058 sample_t getSample (
bool& valid,
unsigned int i);
00060 double mean (
bool& valid) {
00061
return Stat::mean (valid,
population); }
00063 double confInterval (
bool& valid,
double cl) {
00064
return Stat::confInterval (valid,
population, cl); }
00065
00067
void dump (std::ostream& os);
00068 };
00069
00071 class AvgMeasure :
public Object {
00073 std::vector<Population>
populations;
00075 std::vector<bool>
valid;
00076
public:
00078 AvgMeasure () :
Object ("
AvgMeasure") { }
00080 ~AvgMeasure () { }
00081
00083
void addSample (sample_t x,
unsigned int id);
00085
Population& getPopulation (
unsigned int id);
00087
bool getValid (
unsigned int id);
00089 unsigned int getSize ()
const {
return populations.size(); }
00090 };
00091
00093
00106 class DstMeasure :
public Object {
00108 std::vector< std::vector<Population> >
populations;
00110
00115 std::vector< std::vector<Population> >
populationsCDF;
00117 std::vector< std::vector<bool> >
valid;
00119 sample_t
binSize;
00121 sample_t
distLower;
00123 bool binSizeSet;
00125 bool distLowerSet;
00126
00128 std::vector<Population>
meanPopulations;
00130 std::vector<Population>
medianPopulations;
00132 std::vector<Population>
percentile95Populations;
00134 std::vector<Population>
percentile99Populations;
00136 std::vector<unsigned int>
derivedLast;
00137
public:
00139 DstMeasure () :
Object ("
DstMeasure") { }
00141 ~DstMeasure () { }
00142
00144
void addSample (sample_t x,
unsigned int id,
unsigned int bin);
00146
Population& getPopulation (
unsigned int id,
unsigned int bin);
00148
Population& getPopulationCDF (
unsigned int id,
unsigned int bin);
00150
Population& getMeanPopulation (
unsigned int id);
00152
Population& getMedianPopulation (
unsigned int id);
00154
Population& getPercentile95Population (
unsigned int id);
00156
Population& getPercentile99Population (
unsigned int id);
00157
00159
void computeDerivedStatistics (
unsigned int id);
00160
00162
bool getValid (
unsigned int id,
unsigned int bin);
00164 unsigned int getSize ()
const {
return populations.size(); }
00166
unsigned int getSize (
unsigned int id);
00168 void setBinSize (sample_t s) {
binSize = s;
binSizeSet =
true; }
00170 void setDistLower (sample_t s) {
distLower = s;
distLowerSet =
true; }
00172 sample_t
getBinSize ()
const {
return binSize; }
00174 sample_t
getDistLower ()
const {
return distLower; }
00175 };
00176
00178 class Metrics :
public Object {
00179 std::map<std::string, AvgMeasure> avgMeasures;
00180 std::map<std::string, DstMeasure> dstMeasures;
00181
public:
00183 Metrics () :
Object ("
Metrics") { }
00185 ~Metrics () { }
00186
00188
void addSample (std::string m, sample_t x,
unsigned int id);
00190
void addSample (std::string m, sample_t x,
unsigned int id,
unsigned int bin);
00192
void setBinSize (std::string m, sample_t binSize);
00194
void setDistLower (std::string m, sample_t distLower);
00195
00197 std::map<std::string, AvgMeasure>&
getAvgMeasures () {
00198
return avgMeasures; }
00200 std::map<std::string, DstMeasure>&
getDstMeasures () {
00201
return dstMeasures; }
00202
00204
void dump (std::ostream& os);
00205 };
00206
00207
#endif // __MEASURE_MEASURE_H