app/testpmd: add latency statistics calculation
[dpdk.git] / app / test-pmd / parameters.c
index 28db8cd..f92fb4a 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,10 @@ usage(char* progname)
               "the packet will be enqueued into the rx drop-queue. "
               "If the drop-queue doesn't exist, the packet is dropped. "
               "By default drop-queue=127.\n");
+#ifdef RTE_LIBRTE_LATENCY_STATS
+       printf("  --latencystats=N: enable latency and jitter statistcs "
+              "monitoring on forwarding lcore id N.\n");
+#endif
        printf("  --crc-strip: enable CRC stripping by hardware.\n");
        printf("  --enable-lro: enable large receive offload.\n");
        printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
@@ -526,6 +530,9 @@ launch_args_parse(int argc, char** argv)
                { "pkt-filter-report-hash",     1, 0, 0 },
                { "pkt-filter-size",            1, 0, 0 },
                { "pkt-filter-drop-queue",      1, 0, 0 },
+#ifdef RTE_LIBRTE_LATENCY_STATS
+               { "latencystats",               1, 0, 0 },
+#endif
                { "crc-strip",                  0, 0, 0 },
                { "enable-lro",                 0, 0, 0 },
                { "enable-rx-cksum",            0, 0, 0 },
@@ -766,6 +773,19 @@ launch_args_parse(int argc, char** argv)
                                                 "drop queue %d invalid - must"
                                                 "be >= 0 \n", n);
                        }
+#ifdef RTE_LIBRTE_LATENCY_STATS
+                       if (!strcmp(lgopts[opt_idx].name,
+                                   "latencystats")) {
+                               n = atoi(optarg);
+                               if (n >= 0) {
+                                       latencystats_lcore_id = (lcoreid_t) n;
+                                       latencystats_enabled = 1;
+                               } else
+                                       rte_exit(EXIT_FAILURE,
+                                                "invalid lcore id %d for latencystats"
+                                                " must be >= 0\n", n);
+                       }
+#endif
                        if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
                                rx_mode.hw_strip_crc = 1;
                        if (!strcmp(lgopts[opt_idx].name, "enable-lro"))