From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 14E1A4CE4 for ; Wed, 18 Jan 2017 00:24:45 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 17 Jan 2017 15:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,246,1477983600"; d="scan'208";a="49848033" Received: from rhorton-mobl.ger.corp.intel.com (HELO VM.ger.corp.intel.com) ([10.252.25.111]) by orsmga004.jf.intel.com with ESMTP; 17 Jan 2017 15:24:44 -0800 From: Remy Horton To: dev@dpdk.org Cc: Harry van Haaren , Thomas Monjalon , Reshma Pattan Date: Tue, 17 Jan 2017 23:24:34 +0000 Message-Id: <1484695474-1155-8-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484695474-1155-1-git-send-email-remy.horton@intel.com> References: <1484695474-1155-1-git-send-email-remy.horton@intel.com> Subject: [dpdk-dev] [PATCH v8 7/7] app/test-pmd: add latency statistics calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 23:24:46 -0000 From: Harry van Haaren This patch adds latency stats commandline argument to testpmd, allowing to specify the lcore to use for latencystats updates. Signed-off-by: Reshma Pattan Signed-off-by: Harry van Haaren Signed-off-by: Remy Horton --- v7 -> v8 changes: - add optarg to enable latencystats, and which core to use for polling. - implement polling of rte_latencystats_update() from lcore - license year updates --- app/test-pmd/parameters.c | 20 +++++++++++++++++++- app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 6 +++++- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 28db8cd..30b60ba 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -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 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,7 @@ 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 }, + { "latencystats", 1, 0, 0 }, { "crc-strip", 0, 0, 0 }, { "enable-lro", 0, 0, 0 }, { "enable-rx-cksum", 0, 0, 0 }, @@ -766,6 +771,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")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index de60c09..70218bc 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -83,6 +83,10 @@ #ifdef RTE_LIBRTE_BITRATE #include #endif +#include +#ifdef RTE_LIBRTE_LATENCY_STATS +#include +#endif #include "testpmd.h" @@ -276,6 +280,20 @@ uint32_t bypass_timeout = RTE_BYPASS_TMT_OFF; #endif +#ifdef RTE_LIBRTE_LATENCY_STATS + +/* + * Set when latency stats is enabled in the commandline + */ +uint8_t latencystats_enabled; + +/* + * Lcore ID to serive latency statistics. + */ +lcoreid_t latencystats_lcore_id = -1; + +#endif + /* * Ethernet device configuration. */ @@ -955,6 +973,11 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) tics_datum = tics_current; } #endif +#ifdef RTE_LIBRTE_LATENCY_STATS + if (latencystats_lcore_id == rte_lcore_id()) + rte_latencystats_update(); +#endif + } while (! fc->stopped); } @@ -2108,6 +2131,9 @@ signal_handler(int signum) /* uninitialize packet capture framework */ rte_pdump_uninit(); #endif +#ifdef RTE_LIBRTE_LATENCY_STATS + rte_latencystats_uninit(); +#endif force_quit(); /* exit with the expected status */ signal(signum, SIG_DFL); @@ -2166,6 +2192,17 @@ main(int argc, char** argv) FOREACH_PORT(port_id, ports) rte_eth_promiscuous_enable(port_id); +#ifdef RTE_LIBRTE_LATENCY_STATS + if (latencystats_enabled != 0) { + int ret = rte_latencystats_init(1, NULL); + if (ret) + printf("Warning: latencystats init()" + " returned error %d\n", ret); + printf("Latencystats running on lcore %d\n", + latencystats_lcore_id); + } +#endif + /* Setup bitrate stats */ #ifdef RTE_LIBRTE_BITRATE bitrate_data = rte_stats_bitrate_create(); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 0a9a1af..35f7477 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -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 @@ -381,6 +381,10 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping; extern uint16_t mbuf_data_size; /**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs; + +extern uint8_t latencystats_enabled; +extern lcoreid_t latencystats_lcore_id; + extern struct rte_fdir_conf fdir_conf; /* -- 2.5.5