# HG changeset patch # User Mychaela Falconia # Date 1582598585 0 # Node ID 4be92bcd15351e7f9165464eaf5b5305101ac3bc # Parent 39b74c39d914ee72fc155204c37866c6d2efdcf3 fc-loadtool: added operation time reporting to flash erase diff -r 39b74c39d914 -r 4be92bcd1535 loadtools/flmisc.c --- a/loadtools/flmisc.c Tue Feb 25 01:33:23 2020 +0000 +++ b/loadtools/flmisc.c Tue Feb 25 02:43:05 2020 +0000 @@ -8,6 +8,7 @@ #include #include #include +#include #include "flash.h" extern struct flash_bank_info flash_bank_info[2]; @@ -129,6 +130,8 @@ char *strtoul_endp; struct sector_info *startsec, *endsec, *sp; int stat; + time_t start_time, finish_time; + unsigned duration, mm, ss; if (argc != 4) { inv: fprintf(stderr, "usage: %s %s hex-start-offset hex-length\n", @@ -166,6 +169,7 @@ if (get_flash_sector_range(bi, offset, len, &startsec, &endsec) < 0) return(-1); printf("Erasing %d sector(s)\n", endsec - startsec); + time(&start_time); for (sp = startsec; sp < endsec; sp++) { stat = bi->ops->erase_sector(bi, sp); if (stat) @@ -173,7 +177,12 @@ putchar('.'); fflush(stdout); } + time(&finish_time); putchar('\n'); + duration = finish_time - start_time; + mm = duration / 60; + ss = duration - mm * 60; + printf("Operation completed in %um%us\n", mm, ss); return(0); }