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

Function filter

libCacheSim/bin/traceUtils/traceFilterMain.cpp:31–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29} __attribute__((packed));
30
31void filter(reader_t *reader, cache_t *cache, std::string ofilepath) {
32 request_t *req = new_request();
33
34 std::ofstream output_file(ofilepath, std::ios::binary);
35 struct output_format output_req;
36 output_req.next_access_vtime = -2;
37
38 read_one_req(reader, req);
39 uint64_t start_ts = (uint64_t)req->clock_time;
40
41 int64_t n_req = 0, n_written_req = 0;
42 while (req->valid) {
43 n_req++;
44 req->clock_time -= start_ts;
45 if (cache->get(cache, req) == false) {
46 output_req.clock_time = req->clock_time;
47 output_req.obj_id = req->obj_id;
48 output_req.obj_size = req->obj_size;
49 output_file.write((char *)&output_req, sizeof(struct output_format));
50 n_written_req++;
51 }
52
53 read_one_req(reader, req);
54 }
55
56 INFO("write %ld/%ld %.4lf requests to file %s\n", (long) n_written_req, (long) n_req,
57 (double)n_written_req / n_req, ofilepath.c_str());
58 free_request(req);
59 output_file.close();
60}
61} // namespace TraceFilter
62
63int main(int argc, char *argv[]) {

Callers 1

mainFunction · 0.70

Calls 4

new_requestFunction · 0.85
read_one_reqFunction · 0.85
free_requestFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected