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

Method output_mrc

example/cacheHierarchy/simulator.cpp:50–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void Simulator::output_mrc(string &algo, vector<uint64_t> cache_sizes,
51 string &trace_path, string &mrc_output_path) {
52 char alg[] = "LRU";
53 reader_init_param_t reader_init_params = {
54 .time_field = 1, .obj_id_field = 2, .obj_size_field = 3};
55 reader_init_params.binary_fmt_str = "<III";
56 reader_t *reader =
57 open_trace(trace_path.c_str(), BIN_TRACE, &reader_init_params);
58
59 common_cache_params_t ccparams = {.cache_size = cache_sizes[0]};
60 cache_t *cache = create_cache(algo.c_str(), ccparams, nullptr);
61
62 uint64_t cache_size_array[cache_sizes.size()];
63 std::copy(cache_sizes.begin(), cache_sizes.end(), cache_size_array);
64
65 auto mrc = simulate_at_multi_sizes(reader, cache, cache_sizes.size(),
66 cache_size_array, nullptr, 0, 0,
67 std::thread::hardware_concurrency(), false);
68
69 std::ofstream mrc_ofs(mrc_output_path);
70 mrc_ofs << "# L2, " << mrc[0].n_req << " req, " << mrc[0].n_req_byte
71 << " byte" << std::endl;
72 mrc_ofs << "# cache size, miss_cnt, miss_byte" << std::endl;
73 for (int i = 0; i < cache_sizes.size(); i++) {
74 mrc_ofs << mrc[i].cache_size << "," << mrc[i].n_miss << ","
75 << mrc[i].n_miss_byte << std::endl;
76 }
77
78 mrc_ofs.close();
79}

Callers

nothing calls this directly

Calls 7

open_traceFunction · 0.85
copyFunction · 0.85
simulate_at_multi_sizesFunction · 0.85
create_cacheFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected