| 48 | } |
| 49 | |
| 50 | void 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 | } |
nothing calls this directly
no test coverage detected