]> git.proxmox.com Git - ceph.git/blob - ceph/src/exporter/util.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / exporter / util.h
1 #include "common/hostname.h"
2 #include <chrono>
3 #include <string>
4
5 #define TIMED_FUNCTION() BlockTimer timer(__FILE__, __FUNCTION__)
6
7 class BlockTimer {
8 public:
9 BlockTimer(std::string file, std::string function);
10 ~BlockTimer();
11 void stop();
12 double get_ms();
13 private:
14 std::chrono::duration<double, std::milli> ms;
15 std::string file, function;
16 bool stopped;
17 std::chrono::time_point<std::chrono::high_resolution_clock> t1, t2;
18 };
19
20 bool string_is_digit(std::string s);
21 std::string read_file_to_string(std::string path);
22 std::string get_hostname(std::string path);
23
24 void promethize(std::string &name);