aboutsummaryrefslogtreecommitdiff
path: root/src/common/timings.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-12-28 12:38:46 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-28 15:45:37 +0000
commit1eef05658812a881af9b143aed723102e015908b (patch)
tree0189bd9bbca40bbf30ce14b60f65caf122460bf0 /src/common/timings.h
parentMerge pull request #4843 (diff)
downloadmonero-1eef05658812a881af9b143aed723102e015908b.tar.xz
performance_tests: better stats, and keep track of timing history
Diffstat (limited to 'src/common/timings.h')
-rw-r--r--src/common/timings.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/timings.h b/src/common/timings.h
new file mode 100644
index 000000000..fb905611f
--- /dev/null
+++ b/src/common/timings.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include <map>
+
+class TimingsDatabase
+{
+public:
+ struct instance
+ {
+ time_t t;
+ size_t npoints;
+ double min, max, mean, median, stddev, npskew;
+ std::vector<uint64_t> deciles;
+ };
+
+public:
+ TimingsDatabase();
+ TimingsDatabase(const std::string &filename);
+ ~TimingsDatabase();
+
+ std::vector<instance> get(const char *name) const;
+ void add(const char *name, const instance &data);
+
+private:
+ bool load();
+ bool save();
+
+private:
+ std::string filename;
+ std::multimap<std::string, instance> instances;
+};