From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v3 4/4] app/testpmd: display/clear forwarding stats on demand Date: Thu, 21 Mar 2019 18:50:05 +0000 Message-ID: <08af7320-82ba-da2b-ae0f-edda94316805@intel.com> References: <1552318522-18777-1-git-send-email-david.marchand@redhat.com> <1553076154-3907-1-git-send-email-david.marchand@redhat.com> <1553076154-3907-5-git-send-email-david.marchand@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, ramirose@gmail.com, arybchenko@solarflare.com To: David Marchand , dev@dpdk.org Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D9F011B612 for ; Thu, 21 Mar 2019 19:50:09 +0100 (CET) In-Reply-To: <1553076154-3907-5-git-send-email-david.marchand@redhat.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/20/2019 10:02 AM, David Marchand wrote: > Add a new "show/clear fwd stats all" command to display fwd and port > statistics on the fly. > > To be able to do so, the (testpmd only) rte_port structure can't be used > to maintain any statistics. > Moved the stats dump parts from stop_packet_forwarding() and merge with > fwd_port_stats_display() into fwd_stats_display(). > fwd engine statistics are then aggregated into a local per port array. > > Signed-off-by: David Marchand <...> > +/* show/clear fwd engine statistics */ > +struct fwd_result { > + cmdline_fixed_string_t action; > + cmdline_fixed_string_t fwd; > + cmdline_fixed_string_t stats; > + cmdline_fixed_string_t all; > +}; > + > +cmdline_parse_token_string_t cmd_fwd_action = > + TOKEN_STRING_INITIALIZER(struct fwd_result, action, "show#clear"); > +cmdline_parse_token_string_t cmd_fwd_fwd = > + TOKEN_STRING_INITIALIZER(struct fwd_result, fwd, "fwd"); > +cmdline_parse_token_string_t cmd_fwd_stats = > + TOKEN_STRING_INITIALIZER(struct fwd_result, stats, "stats"); > +cmdline_parse_token_string_t cmd_fwd_all = > + TOKEN_STRING_INITIALIZER(struct fwd_result, all, "all"); Do we need "all"? Normally we have it when there is selection between specific or all, here only option is all. > + > +static void > +cmd_fwd_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct fwd_result *res = parsed_result; > + > + if (!strcmp(res->action, "show")) > + fwd_stats_display(); > + else > + fwd_stats_reset(); > +} > + > +static cmdline_parse_inst_t cmd_fwdall = { > + .f = cmd_fwd_parsed, > + .data = NULL, > + .help_str = "show|clear fwd stats all", > + .tokens = { > + (void *)&cmd_fwd_action, > + (void *)&cmd_fwd_fwd, > + (void *)&cmd_fwd_stats, > + (void *)&cmd_fwd_all, > + NULL, > + }, > +}; in 'app/test-pmd/cmdline.c', there is 'cmd_help_long_parsed()' function to display the help output, can you please add new command information there too? > + > /* *** READ PORT REGISTER *** */ > struct cmd_read_reg_result { > cmdline_fixed_string_t read; > @@ -18559,6 +18602,7 @@ struct cmd_show_tx_metadata_result { > (cmdline_parse_inst_t *)&cmd_showqueue, > (cmdline_parse_inst_t *)&cmd_showportall, > (cmdline_parse_inst_t *)&cmd_showcfg, > + (cmdline_parse_inst_t *)&cmd_fwdall, command name looks misleading 'fwdall', it feels like it is something doing forwarding more than display, what about following same syntax with above 'cmd_showportall', so 'cmd_showfwdall' or 'cmd_showfwd' based on your answer to drop "all"? <...> > +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES > + fwd_cycles += fs->core_cycles; > +#endif Ahh, it seems I missed this config option, looks useful :) I wonder if it is documented anywhere.