From: Sankar Chokkalingam <sankarx.chokkalin...@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 at 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