DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com,
	Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Subject: [dpdk-dev] [PATCH] ip_pipeline: add command for multiple execution of run <file>
Date: Fri,  6 May 2016 20:09:03 +0100	[thread overview]
Message-ID: <1462561743-76966-1-git-send-email-jasvinder.singh@intel.com> (raw)

From: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>

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 <file> <count> <interval>

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 <sankarx.chokkalingam@intel.com>
---
 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,
-- 
1.8.3.1

             reply	other threads:[~2016-05-06 19:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 19:09 Jasvinder Singh [this message]
2016-05-24 17:20 ` Dumitrescu, Cristian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462561743-76966-1-git-send-email-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=sankarx.chokkalingam@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).