[U-Boot] [PATCH v2] common/cmd_ext_common: measure throughput
Andreas Bießmann
andreas.devel at googlemail.com
Fri Oct 26 10:20:10 CEST 2012
This patch adds time measurement and throughput calculation for the ext2load and
ext4load commands.
The output of ext2load changes from
---8<---
Loading file "/boot/uImage" from mmc device 0:1
1830666 bytes read
--->8---
to
---8<---
Loading file "/boot/uImage" from mmc device 0:1
1830666 bytes read in 237 ms (7.4 MiB/s)
--->8---
Signed-off-by: Andreas Bießmann <andreas.devel at googlemail.com>
---
since v1:
* use 'time' instead of 'time_start' as suggested by Wolfgang
common/cmd_ext_common.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/common/cmd_ext_common.c b/common/cmd_ext_common.c
index 1952f4d..63f1b1f 100644
--- a/common/cmd_ext_common.c
+++ b/common/cmd_ext_common.c
@@ -76,6 +76,7 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
char buf[12];
unsigned long count;
const char *addr_str;
+ unsigned long time;
count = 0;
addr = simple_strtoul(argv[3], NULL, 16);
@@ -135,18 +136,26 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
if ((count < filelen) && (count != 0))
filelen = count;
+ time = get_timer(0);
if (ext4fs_read((char *)addr, filelen) != filelen) {
printf("** Unable to read \"%s\" from %s %d:%d **\n",
filename, argv[1], dev, part);
ext4fs_close();
goto fail;
}
+ time = get_timer(time);
ext4fs_close();
/* Loading ok, update default load address */
load_addr = addr;
- printf("%d bytes read\n", filelen);
+ printf("%d bytes read in %lu ms", filelen, time);
+ if (time > 0) {
+ puts(" (");
+ print_size(filelen / time * 1000, "/s");
+ puts(")");
+ }
+ puts("\n");
sprintf(buf, "%X", filelen);
setenv("filesize", buf);
--
1.7.10.4
More information about the U-Boot
mailing list