summaryrefslogtreecommitdiff
path: root/lib/perf_check.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
commit669df123648aaa6aeccc70206b5417bc48b4e9ae (patch)
tree463c107a8d6405020bb304f7a7253e6b64afeee0 /lib/perf_check.h
parent5.18 (diff)
downloadFreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.gz
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.bz2
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.zip
5.19
Diffstat (limited to 'lib/perf_check.h')
-rw-r--r--lib/perf_check.h30
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
bgstack15