-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtracer.hpp
50 lines (37 loc) · 1.04 KB
/
tracer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// See license for details
#include <cstdint>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "dinst.hpp"
class Tracer {
public:
static bool open(const std::string &fname);
Tracer() {
// disabled until open
track_from = UINT64_MAX;
track_to = UINT64_MAX;
}
static void track_range(uint64_t from, uint64_t to = UINT64_MAX);
static void stage(const Dinst *, const std::string ev);
static void event(const Dinst *, const std::string ev);
static void commit(const Dinst *);
static void flush(const Dinst *);
static void advance_clock();
~Tracer() {
if (ofs) {
ofs.close();
}
}
private:
static void adjust_clock();
static inline absl::flat_hash_set<uint64_t> started;
static inline std::vector<std::string> pending_end;
static inline bool main_clock_set;
static inline Time_t last_clock;
static inline uint64_t track_from;
static inline uint64_t track_to;
static inline std::ofstream ofs;
};