| 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <string> |
| 5 | #include <vector> |
| 6 | #include <map> |
| 7 | |
| 8 | class TimingsDatabase |
| 9 | { |
| 10 | public: |
| 11 | struct instance |
| 12 | { |
| 13 | time_t t; |
| 14 | size_t npoints; |
| 15 | double min, max, mean, median, stddev, npskew; |
| 16 | std::vector<uint64_t> deciles; |
| 17 | }; |
| 18 | |
| 19 | public: |
| 20 | TimingsDatabase(); |
| 21 | TimingsDatabase(const std::string &filename); |
| 22 | ~TimingsDatabase(); |
| 23 | |
| 24 | std::vector<instance> get(const char *name) const; |
| 25 | void add(const char *name, const instance &data); |
| 26 | |
| 27 | private: |
| 28 | bool load(); |
| 29 | bool save(); |
| 30 | |
| 31 | private: |
| 32 | std::string filename; |
| 33 | std::multimap<std::string, instance> instances; |
| 34 | }; |