MCPcopy Create free account
hub / github.com/F-Stack/f-stack / proc_info_parse_args

Function proc_info_parse_args

dpdk/app/proc-info/main.c:418–627  ·  view source on GitHub ↗

Parse the argument given in the command line of the application */

Source from the content-addressed store, hash-verified

416
417/* Parse the argument given in the command line of the application */
418static int
419proc_info_parse_args(int argc, char **argv)
420{
421 int opt;
422 int option_index;
423 char *prgname = argv[0];
424 static struct option long_option[] = {
425 {"stats", 0, NULL, 0},
426 {"stats-reset", 0, NULL, 0},
427 {"xstats", 0, NULL, 0},
428#ifdef RTE_LIB_METRICS
429 {"metrics", 0, NULL, 0},
430#endif
431 {"xstats-reset", 0, NULL, 0},
432 {"xstats-name", required_argument, NULL, 1},
433 {"collectd-format", 0, NULL, 0},
434 {"xstats-ids", 1, NULL, 1},
435 {"host-id", 0, NULL, 0},
436 {"show-port", 0, NULL, 0},
437 {"show-port-private", 0, NULL, 0},
438 {"show-tm", 0, NULL, 0},
439 {"show-crypto", 0, NULL, 0},
440 {"show-ring", optional_argument, NULL, 0},
441 {"show-mempool", optional_argument, NULL, 0},
442 {"iter-mempool", required_argument, NULL, 0},
443 {"dump-regs", required_argument, NULL, 0},
444 {"version", 0, NULL, 0},
445 {"firmware-version", 0, NULL, 0},
446 {"show-rss-reta", 0, NULL, 0},
447 {"show-module-eeprom", 0, NULL, 0},
448 {"show-rx-descriptor", required_argument, NULL, 1},
449 {"show-tx-descriptor", required_argument, NULL, 1},
450 {"show-edev-queue-xstats", required_argument, NULL, 0},
451 {"show-edev-port-xstats", required_argument, NULL, 0},
452 {"edev-dump-xstats", required_argument, NULL, 0},
453 {"edev-reset-xstats", required_argument, NULL, 0},
454 {"show-edev-device-xstats", required_argument, NULL, 0},
455 {NULL, 0, 0, 0}
456 };
457
458 if (argc == 1)
459 proc_info_usage(prgname);
460
461 /* Parse command line */
462 while ((opt = getopt_long(argc, argv, "p:m",
463 long_option, &option_index)) != EOF) {
464 switch (opt) {
465 /* portmask */
466 case 'p':
467 if (parse_portmask(optarg) < 0) {
468 proc_info_usage(prgname);
469 return -1;
470 }
471 break;
472 case 'm':
473 mem_info = 1;
474 break;
475 case 0:

Callers 1

mainFunction · 0.85

Calls 12

proc_info_usageFunction · 0.85
getopt_longFunction · 0.85
strncmpFunction · 0.85
parse_xstats_idsFunction · 0.85
parse_descriptor_paramFunction · 0.85
parse_portmaskFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected