app/testpmd: print statistics periodically
[dpdk.git] / app / test-pmd / parameters.c
index 0a88844..958b3d0 100644 (file)
@@ -89,7 +89,7 @@ usage(char* progname)
               "[--cmdline-file=FILENAME] "
 #endif
               "[--help|-h] | [--auto-start|-a] | ["
-              "--tx-first | "
+              "--tx-first | --stats-period=PERIOD | "
               "--coremask=COREMASK --portmask=PORTMASK --numa "
               "--mbuf-size= | --total-num-mbufs= | "
               "--nb-cores= | --nb-ports= | "
@@ -112,6 +112,8 @@ usage(char* progname)
        printf("  --help: display this message and quit.\n");
        printf("  --tx-first: start forwarding sending a burst first "
               "(only if interactive is disabled).\n");
+       printf("  --stats-period=PERIOD: statistics will be shown "
+              "every PERIOD seconds (only if interactive is disabled).\n");
        printf("  --nb-cores=N: set the number of forwarding cores "
               "(1 <= N <= %d).\n", nb_lcores);
        printf("  --nb-ports=N: set the number of forwarding ports "
@@ -570,6 +572,7 @@ launch_args_parse(int argc, char** argv)
                { "eth-peer",                   1, 0, 0 },
 #endif
                { "tx-first",                   0, 0, 0 },
+               { "stats-period",               1, 0, 0 },
                { "ports",                      1, 0, 0 },
                { "nb-cores",                   1, 0, 0 },
                { "nb-ports",                   1, 0, 0 },
@@ -683,6 +686,18 @@ launch_args_parse(int argc, char** argv)
                                                "packets first\n");
                                tx_first = 1;
                        }
+                       if (!strcmp(lgopts[opt_idx].name, "stats-period")) {
+                               char *end = NULL;
+                               unsigned int n;
+
+                               n = strtoul(optarg, &end, 10);
+                               if ((optarg[0] == '\0') || (end == NULL) ||
+                                               (*end != '\0'))
+                                       break;
+
+                               stats_period = n;
+                               break;
+                       }
                        if (!strcmp(lgopts[opt_idx].name,
                                    "eth-peers-configfile")) {
                                if (init_peer_eth_addrs(optarg) != 0)