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

Function parse_cmd

libCacheSim/bin/traceUtils/cli_parser.cpp:231–260  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

229 * @param argv
230 */
231void parse_cmd(int argc, char *argv[], struct arguments *args) {
232 init_arg(args);
233
234 static struct argp argp = {.options = options,
235 .parser = parse_opt,
236 .args_doc = args_doc,
237 .doc = doc,
238 .children = NULL,
239 .help_filter = NULL,
240 .argp_domain = NULL};
241
242 argp_parse(&argp, argc, argv, 0, 0, args);
243
244 args->trace_path = args->args[0];
245 args->trace_type_str = args->args[1];
246 assert(N_ARGS == 2);
247
248 args->trace_type =
249 trace_type_str_to_enum(args->trace_type_str, args->trace_path);
250 args->reader = create_reader(args->trace_type_str, args->trace_path,
251 args->trace_type_params, args->n_req,
252 args->ignore_obj_size, 0);
253 if (args->sample_ratio < 1.0) {
254 INFO("create a spatial sampler with sample ratio %.4flf\n",
255 args->sample_ratio);
256 args->reader->sampler = create_spatial_sampler(args->sample_ratio);
257 }
258
259 print_parsed_arg(args);
260}
261} // namespace cli

Callers 3

mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70

Calls 6

assertFunction · 0.85
trace_type_str_to_enumFunction · 0.85
create_readerFunction · 0.85
create_spatial_samplerFunction · 0.85
print_parsed_argFunction · 0.85
init_argFunction · 0.70

Tested by

no test coverage detected