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

Method load_config

example/cacheHierarchy/myconfig.cpp:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace std;
14
15void Myconfig::load_config() {
16 FILE *fp = fopen(config_path.c_str(), "r");
17 auto yamlconfig = fkyaml::node::deserialize(fp);
18 assert(yamlconfig["L1"]["path"].is_sequence());
19 assert(yamlconfig["L2"]["size"].is_sequence());
20
21 n_l1 = yamlconfig["L1"]["path"].size();
22 uint64_t l1_size =
23 Utils::convert_size_str(yamlconfig["L1"]["size"].as_str());
24 for (int i = 0; i < n_l1; i++) {
25 l1_sizes.push_back(l1_size);
26 l1_sizes_str.push_back(yamlconfig["L1"]["size"].as_str());
27 }
28
29 for (std::size_t i = 0; i < n_l1; i++) {
30 l1_trace_path.push_back(yamlconfig["L1"]["path"][i].as_str());
31 }
32
33 for (std::size_t i = 0; i < yamlconfig["L2"]["size"].size(); i++) {
34 string sz = yamlconfig["L2"]["size"][i].as_str();
35 l2_sizes.push_back(Utils::convert_size_str(sz));
36 l2_sizes_str.push_back(sz);
37 }
38
39 output_path = yamlconfig["output"].as_str();
40}
41
42void Myconfig::_prepare() {
43 for (int i = 0; i < n_l1; i++) {

Callers

nothing calls this directly

Calls 3

deserializeFunction · 0.85
assertFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected