summaryrefslogtreecommitdiffstats
path: root/src/exporter/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/exporter/util.h')
-rw-r--r--src/exporter/util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/exporter/util.h b/src/exporter/util.h
new file mode 100644
index 000000000..2628864d5
--- /dev/null
+++ b/src/exporter/util.h
@@ -0,0 +1,24 @@
+#include "common/hostname.h"
+#include <chrono>
+#include <string>
+
+#define TIMED_FUNCTION() BlockTimer timer(__FILE__, __FUNCTION__)
+
+class BlockTimer {
+ public:
+ BlockTimer(std::string file, std::string function);
+ ~BlockTimer();
+ void stop();
+ double get_ms();
+ private:
+ std::chrono::duration<double, std::milli> ms;
+ std::string file, function;
+ bool stopped;
+ std::chrono::time_point<std::chrono::high_resolution_clock> t1, t2;
+};
+
+bool string_is_digit(std::string s);
+std::string read_file_to_string(std::string path);
+std::string get_hostname(std::string path);
+
+void promethize(std::string &name);