ACK: [PATCH] lib: framework: Increase precision of progress, add a spinner progress indicator

Alex Hung alex.hung at canonical.com
Thu Jan 31 06:58:40 UTC 2013


On 01/10/2013 06:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Some tests such as the cpufreq and cstates tests take rather a long time so it
> makes sense to increase the precision to the % progress output to indicate that
> something is actually happening.  Also, add a progress spinner indicator to also
> provide some feedback that the test is actually active rather than hung.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_framework.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 7290912..25ccc41 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -380,11 +380,13 @@ void fwts_framework_minor_test_progress(fwts_framework *fw, const int percent, c
>   	if (fw->show_progress) {
>   		char buf[1024];
>   		char truncbuf[256];
> +		static int index;
>
>   		snprintf(buf, sizeof(buf), "%s %s",fw->current_minor_test_name, message);
>   		fwts_framework_strtrunc(truncbuf, buf, width-9);
>
> -		fprintf(stderr, "  %-*.*s: %3.0f%%\r", width-9, width-9, truncbuf, progress);
> +		fprintf(stderr, "  %-*.*s: %5.1f%% %c\r",
> +			width-13, width-13, truncbuf, progress, "/-\\|"[index++ & 3]);
>   		fflush(stderr);
>   	}
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list