diff options
Diffstat (limited to 'lib/perf_check.h')
-rw-r--r-- | lib/perf_check.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/perf_check.h b/lib/perf_check.h index 3e04b778..9d82be57 100644 --- a/lib/perf_check.h +++ b/lib/perf_check.h @@ -9,31 +9,37 @@ #include <map> #include <string> +#include <zen/optional.h> class PerfCheck { public: - PerfCheck(unsigned int windowSizeRemainingTime, //unit: [ms] - unsigned int windowSizeBytesPerSecond); // + PerfCheck(unsigned int windowSizeRemainingTime, //unit: [ms] + unsigned int windowSizeSpeed); // ~PerfCheck(); - void addSample(int objectsCurrent, double dataCurrent, long timeMs); //timeMs must be ascending! + void addSample(int itemsCurrent, double dataCurrent, long timeMs); //timeMs must be ascending! - std::wstring getRemainingTime(double dataRemaining) const; - std::wstring getBytesPerSecond() const; //for window + zen::Opt<std::wstring> getRemainingTime(double dataRemaining) const; + zen::Opt<std::wstring> getBytesPerSecond() const; //for window + zen::Opt<std::wstring> getItemsPerSecond() const; //for window private: - const long windowSizeRemTime; //unit: [ms] - const long windowSizeBPS; // - const long windowMax; - struct Record { - Record(int objCount, double data) : objCount_(objCount), data_(data) {} - int objCount_; + Record(int itemCount, double data) : itemCount_(itemCount), data_(data) {} + int itemCount_; double data_; //unit: [bytes] }; - std::multimap<long, Record> samples; //time, unit: [ms] + + std::pair<const std::multimap<long, Record>::value_type*, + const std::multimap<long, Record>::value_type*> getBlockFromEnd(long windowSize) const; + + const long windowSizeRemTime; //unit: [ms] + const long windowSizeSpeed_; // + const long windowMax; + + std::map<long, Record> samples; //time, unit: [ms] }; #endif // STATISTICS_H_INCLUDED |