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

Function parse_mini_cmd

libCacheSim/bin/MRC/parser_mini.c:272–350  ·  view source on GitHub ↗

* @brief parse the command line arguments * * @param argc * @param argv */

Source from the content-addressed store, hash-verified

270 * @param argv
271 */
272void parse_mini_cmd(int argc, char *argv[], struct MINI_arguments *args) {
273 init_mini_arg(args);
274
275 static struct argp argp = {.options = options,
276 .parser = parse_opt,
277 .args_doc = args_doc,
278 .doc = doc,
279 .children = NULL,
280 .help_filter = NULL,
281 .argp_domain = NULL};
282
283 argp_parse(&argp, argc, argv, 0, 0, args);
284
285 args->trace_path = args->args[1];
286 args->trace_type_str = args->args[2];
287 parse_eviction_algo(args, args->args[3]);
288
289 if (args->ofilepath[0] == '\0') {
290 char *trace_filename = rindex(args->trace_path, '/');
291 snprintf(args->ofilepath, OFILEPATH_LEN, "%s.cachesim",
292 trace_filename == NULL ? args->trace_path : trace_filename + 1);
293 }
294
295 /* convert trace type string to enum */
296 args->trace_type =
297 trace_type_str_to_enum(args->trace_type_str, args->trace_path);
298
299 reader_init_param_t reader_init_params;
300 memset(&reader_init_params, 0, sizeof(reader_init_params));
301 reader_init_params.ignore_obj_size = args->ignore_obj_size;
302 reader_init_params.ignore_size_zero_req = true;
303 reader_init_params.obj_id_is_num = true;
304 reader_init_params.cap_at_n_req = args->n_req;
305 reader_init_params.sampler = NULL;
306
307 parse_reader_params(args->trace_type_params, &reader_init_params);
308
309 if ((args->trace_type == CSV_TRACE || args->trace_type == PLAIN_TXT_TRACE) &&
310 reader_init_params.obj_size_field == -1) {
311 args->consider_obj_metadata = false;
312 args->ignore_obj_size = true;
313 reader_init_params.ignore_obj_size = true;
314 }
315
316 args->reader =
317 setup_reader(args->trace_path, args->trace_type, &reader_init_params);
318
319 if (args->consider_obj_metadata &&
320 should_disable_obj_metadata(args->reader)) {
321 INFO("disable object metadata\n");
322 args->consider_obj_metadata = false;
323 }
324
325 /** convert the cache sizes from string to int,
326 * if the user specifies 0 or auto, we use 12 cache sizes as fraction of
327 * the working set size
328 * if the user specifies float number, we use the number as the fraction of
329 * the working set size **/

Callers 1

mainFunction · 0.85

Calls 10

init_mini_argFunction · 0.85
trace_type_str_to_enumFunction · 0.85
parse_reader_paramsFunction · 0.85
setup_readerFunction · 0.85
create_admissionerFunction · 0.85
create_prefetcherFunction · 0.85
parse_eviction_algoFunction · 0.70
conv_cache_sizesFunction · 0.70
create_cacheFunction · 0.50

Tested by

no test coverage detected