[PATCH v1 1/1] app/testpmd: add sleep command

Bruce Richardson bruce.richardson at intel.com
Fri May 2 14:37:15 CEST 2025


On Fri, May 02, 2025 at 01:27:29PM +0100, Anatoly Burakov wrote:
> Test-pmd already has a way to run a list of commands from file, but there
> is no way to pause execution for a specified amount of time between two
> commands. This may be necessary for simple automation, particularly for
> waiting on some asynchronous operation such as link status update.
> 
> Add a simple sleep command to wait until certain number of milliseconds has
> passed.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
>  app/test-pmd/cmdline.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index d4bb3ec998..1e429e6d0a 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -151,6 +151,9 @@ static void cmd_help_long_parsed(void *parsed_result,
>  
>  			"quit\n"
>  			"    Quit to prompt.\n\n"
> +
> +			"sleep ms\n"
> +			"    Sleep for ms milliseconds.\n\n"
>  		);
>  	}
>  

A "sleep" command, I would expect to sleep for a certain number of seconds,
for compatibility e.g. with terminal "sleep" command.
To keep this as "ms" granularity, how about making it explicit as a
"sleep_ms" command. Alternatively, how about adding a usleep command? [Not
sure "msleep" works, which is why I suggested sleep_ms instead]

/Bruce


More information about the dev mailing list