00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef BENCHRESULT_H_
00034 #define BENCHRESULT_H_
00035
00036 #include "DllExport.h"
00037
00038 #include "Stopwatch.h"
00039
00040 #include <iomanip>
00041 #include <iostream>
00042 #include <sstream>
00043 #include <string>
00044 #include <vector>
00045
00049 namespace TimeType
00050 {
00055 enum Type
00056 {
00057 WALL_CLOCK = 0,
00058 USER,
00059 SYSTEM,
00060 LAST
00061 };
00062
00064 const char TypeStrings[LAST][100] =
00065 { "wall-clock", "user", "system" };
00066 }
00067
00071 namespace TimeValue
00072 {
00077 enum Value
00078 {
00079 AVERAGE = 0,
00080 MINIMUM,
00081 MAXIMUM,
00082 STD_DEV,
00083 LAST
00084 };
00085
00087 const char ValueStrings[LAST][100] =
00088 { "average", "min", "max", "std-dev" };
00089 }
00090
00096 class CPPBENCH_API BenchResult
00097 {
00098 public:
00099 BenchResult();
00100
00107 BenchResult(std::vector<Stopwatch::Time>& times);
00108 ~BenchResult();
00109
00110 void setName(const std::string& n) { name = n; }
00111
00118 std::string getName() const { return name; }
00119
00120 void setValue(const std::string& v) { val = v; }
00121
00128 std::string getValue() const { return val; }
00129
00130 void setTimeValue(TimeType::Type type, TimeValue::Value valueType, double value);
00131
00144 double getTimeValue(TimeType::Type type, TimeValue::Value valueType) const;
00145
00146 private:
00147
00148 #ifdef WIN32
00149 #pragma warning( push )
00150 #pragma warning( disable : 4251 )
00151 #endif
00152
00153 std::string name;
00154 std::string val;
00155
00156 #ifdef WIN32
00157 #pragma warning( pop )
00158 #endif
00159
00160 double timeValues[TimeType::LAST][TimeValue::LAST];
00161 };
00162
00163 #endif