MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / ReuseDistribution

Class ReuseDistribution

libCacheSim/traceAnalyzer/reuse.h:16–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15namespace traceAnalyzer {
16class ReuseDistribution {
17 public:
18 explicit ReuseDistribution(std::string output_path, int time_window_param = 300,
19 int rtime_granularity_param = 5,
20 int vtime_granularity_param = 1000)
21 : time_window_(time_window_param),
22 rtime_granularity_(rtime_granularity_param),
23 vtime_granularity_(vtime_granularity_param) {
24 turn_on_stream_dump(output_path);
25 };
26
27 ~ReuseDistribution() {
28 stream_dump_rt_ofs.close();
29 stream_dump_vt_ofs.close();
30 }
31
32 void add_req(request_t *req);
33
34 void dump(std::string &path_base);
35
36 private:
37 /* request count for reuse rtime/vtime */
38 std::unordered_map<int32_t, uint32_t> reuse_rtime_req_cnt_;
39 std::unordered_map<int32_t, uint32_t> reuse_vtime_req_cnt_;
40
41 std::unordered_map<int32_t, uint32_t> reuse_rtime_req_cnt_read_;
42 std::unordered_map<int32_t, uint32_t> reuse_rtime_req_cnt_write_;
43 std::unordered_map<int32_t, uint32_t> reuse_rtime_req_cnt_delete_;
44
45 /* used to plot reuse distribution heatmap */
46 const double log_base_ = 1.5;
47 const double log_log_base_ = log(log_base_);
48 const int time_window_;
49 const int rtime_granularity_;
50 const int vtime_granularity_;
51 int64_t next_window_ts_ = -1;
52
53 std::vector<uint32_t> window_reuse_rtime_req_cnt_;
54 std::vector<uint32_t> window_reuse_vtime_req_cnt_;
55
56 std::ofstream stream_dump_rt_ofs;
57 std::ofstream stream_dump_vt_ofs;
58
59 void turn_on_stream_dump(std::string &path_base);
60
61 void stream_dump_window_reuse_distribution();
62};
63
64} // namespace traceAnalyzer

Callers

nothing calls this directly

Calls 1

logFunction · 0.85

Tested by

no test coverage detected