FreeCalypso > hg > freecalypso-tools
changeset 616:4be92bcd1535
fc-loadtool: added operation time reporting to flash erase
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Feb 2020 02:43:05 +0000 |
parents | 39b74c39d914 |
children | 97fe41e9242a |
files | loadtools/flmisc.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <string.h> #include <strings.h> #include <stdlib.h> +#include <time.h> #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); }