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

Function main

libCacheSim/bin/traceUtils/traceFilterMain.cpp:63–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61} // namespace TraceFilter
62
63int main(int argc, char *argv[]) {
64 struct arguments args;
65 cli::parse_cmd(argc, argv, &args);
66
67 if (args.cache_size < 1) {
68 int64_t wss_obj = 0, wss_byte = 0;
69 cal_working_set_size(args.reader, &wss_obj, &wss_byte);
70 if (args.ignore_obj_size) {
71 args.cache_size = (int64_t)(wss_obj * args.cache_size);
72 } else {
73 args.cache_size = (int64_t)(wss_byte * args.cache_size);
74 }
75 }
76
77 common_cache_params_t cc_params = {
78 .cache_size = static_cast<uint64_t>(args.cache_size),
79 .default_ttl = 86400 * 300,
80 .hashpower = 24,
81 .consider_obj_metadata = false};
82
83 if (strcasecmp(args.cache_name, "LRU") == 0) {
84 args.cache = LRU_init(cc_params, NULL);
85 } else if (strcasecmp(args.cache_name, "FIFO") == 0) {
86 args.cache = FIFO_init(cc_params, NULL);
87 } else {
88 ERROR("unsupported cache name %s\n", args.cache_name);
89 exit(1);
90 }
91
92 if (args.ofilepath[0] == '\0') {
93 char *trace_filename = rindex(args.trace_path, '/');
94 snprintf(args.ofilepath, OFILEPATH_LEN, "%s.filter_%s_%lu.oracleGeneral",
95 trace_filename == NULL ? args.trace_path : trace_filename + 1,
96 args.cache_name, static_cast<unsigned long>(args.cache_size));
97 }
98
99 TraceFilter::filter(args.reader, args.cache, args.ofilepath);
100
101 cli::free_arg(&args);
102
103 return 0;
104}

Callers

nothing calls this directly

Calls 6

cal_working_set_sizeFunction · 0.85
LRU_initFunction · 0.85
FIFO_initFunction · 0.85
parse_cmdFunction · 0.70
filterFunction · 0.70
free_argFunction · 0.70

Tested by

no test coverage detected