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

Method convert_size_str

example/cacheHierarchy/utils.cpp:14–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace std;
13
14uint64_t Utils::convert_size_str(string sz_str) {
15 uint64_t sz;
16 string::size_type sz_str_sz = sz_str.length();
17 assert(sz_str[sz_str_sz - 1] == 'B');
18 if (sz_str[sz_str_sz - 2] == 'T') {
19 sz = stol(sz_str.substr(0, sz_str_sz - 2)) * TB;
20 } else if (sz_str[sz_str_sz - 2] == 'G') {
21 sz = stol(sz_str.substr(0, sz_str_sz - 2)) * GB;
22 } else if (sz_str[sz_str_sz - 2] == 'M') {
23 sz = stol(sz_str.substr(0, sz_str_sz - 2)) * MB;
24 } else if (sz_str[sz_str_sz - 2] == 'K') {
25 sz = stol(sz_str.substr(0, sz_str_sz - 2)) * KB;
26 } else {
27 sz = stol(sz_str.substr(0, sz_str_sz - 1));
28 }
29 return sz;
30}
31
32uint64_t TraceUtils::merge_l1_trace(vector<string>& l1_trace_path_vec,
33 string& l2_output_trace_path) {

Callers

nothing calls this directly

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected