| 21 | |
| 22 | namespace traceAnalyzer { |
| 23 | class AccessPattern { |
| 24 | public: |
| 25 | /** |
| 26 | * |
| 27 | * @param n_req the total number of requests in the trace |
| 28 | * @param n_obj the number of objects we would like to sample |
| 29 | */ |
| 30 | explicit AccessPattern(int sample_ratio = 1001) |
| 31 | : sample_ratio_(sample_ratio) { |
| 32 | |
| 33 | if (sample_ratio_ < 1) { |
| 34 | ERROR( |
| 35 | "sample_ratio samples 1/sample_ratio objects, and should be at least " |
| 36 | "1 (no sampling), current value: %d\n", |
| 37 | sample_ratio_); |
| 38 | sample_ratio_ = 1; |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | ~AccessPattern() = default; |
| 43 | |
| 44 | friend ostream &operator<<(ostream &os, const AccessPattern &pattern) { |
| 45 | return os; |
| 46 | } |
| 47 | |
| 48 | void add_req(const request_t *req); |
| 49 | |
| 50 | void dump(string &path_base); |
| 51 | |
| 52 | private: |
| 53 | int64_t n_obj_ = 0; |
| 54 | int64_t n_seen_req_ = 0; |
| 55 | int sample_ratio_ = 1001; |
| 56 | |
| 57 | int64_t start_rtime_ = -1; |
| 58 | unordered_map<obj_id_t, vector<uint32_t>> access_rtime_map_; |
| 59 | unordered_map<obj_id_t, vector<uint32_t>> access_vtime_map_; |
| 60 | }; |
| 61 | } // namespace traceAnalyzer |
nothing calls this directly
no outgoing calls
no test coverage detected