From patchwork Fri May 6 19:09:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 12548 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2040D58F1; Fri, 6 May 2016 21:02:48 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 4A6452C34 for ; Fri, 6 May 2016 21:02:46 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 06 May 2016 12:02:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,587,1455004800"; d="scan'208";a="960469928" Received: from sie-lab-212-251.ir.intel.com (HELO silpixa00381635.ir.intel.com) ([10.237.212.251]) by fmsmga001.fm.intel.com with ESMTP; 06 May 2016 12:02:44 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Sankar Chokkalingam Date: Fri, 6 May 2016 20:09:03 +0100 Message-Id: <1462561743-76966-1-git-send-email-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] ip_pipeline: add command for multiple execution of run X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Sankar Chokkalingam The new command enables the execution of script-file for 'n' number of times in regular intervals. It takes script-file, number of times to be executed, interval between each execution as inputs. Syntax: run Usage: This command helps to collect statistics of ports and pipelines in periodic interval. Example: run port_stats 5 30 The port_stats file may contain the list of port stats commands like p 1 port in 0 stats p 1 port out 0 stats p 2 port in 0 stats p 2 port out 0 stats p 2 port in 1 stats p 2 port out stats. The list of commands in the file will be executed 5 times with the interval of 30 seconds. Signed-off-by: Sankar Chokkalingam --- examples/ip_pipeline/pipeline/pipeline_common_fe.c | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c index a691d42..9f7ef08 100644 --- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c +++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c @@ -1267,9 +1267,59 @@ cmdline_parse_inst_t cmd_run = { }, }; +struct cmd_multirun_file_result { + cmdline_fixed_string_t run_string; + char file_name[APP_FILE_NAME_SIZE]; + uint32_t count; + uint32_t interval; +}; + +static void +cmd_multirun_parsed( + void *parsed_result, + struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_multirun_file_result *params = parsed_result; + uint32_t i; + + for (i = 0; i < params->count; i++) { + app_run_file(cl->ctx, params->file_name); + sleep(params->interval); + } +} + +cmdline_parse_token_string_t cmd_multirun_run_string = + TOKEN_STRING_INITIALIZER(struct cmd_multirun_file_result, run_string, + "run"); + +cmdline_parse_token_string_t cmd_multirun_file_name = + TOKEN_STRING_INITIALIZER(struct cmd_multirun_file_result, file_name, NULL); + +static cmdline_parse_token_num_t cmd_multirun_count = + TOKEN_NUM_INITIALIZER(struct cmd_multirun_file_result, count, UINT32); + +static cmdline_parse_token_num_t cmd_multirun_interval = + TOKEN_NUM_INITIALIZER(struct cmd_multirun_file_result, interval, UINT32); + +cmdline_parse_inst_t cmd_multirun = { + .f = cmd_multirun_parsed, + .data = NULL, + .help_str = "Run CLI script file", + .tokens = { + (void *) &cmd_multirun_run_string, + (void *) &cmd_multirun_file_name, + (void *) &cmd_multirun_count, + (void *) &cmd_multirun_interval, + NULL, + }, +}; + + static cmdline_parse_ctx_t pipeline_common_cmds[] = { (cmdline_parse_inst_t *) &cmd_quit, (cmdline_parse_inst_t *) &cmd_run, + (cmdline_parse_inst_t *) &cmd_multirun, (cmdline_parse_inst_t *) &cmd_link_config, (cmdline_parse_inst_t *) &cmd_link_up,