mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-30 08:30:50 +09:00
fs/fs.c: do_fsload: measure throughput
This patch adds time measurement and throughput calculation for all supported load commands. The output of ext2load changes from ---8<--- 1830666 bytes read --->8--- to ---8<--- 1830666 bytes read in 237 ms (7.4 MiB/s) --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> [agust: rebased and revised commit log] Signed-off-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
parent
624c721f0c
commit
da1fd96ce4
11
fs/fs.c
11
fs/fs.c
@ -257,6 +257,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
|
|||||||
unsigned long pos;
|
unsigned long pos;
|
||||||
int len_read;
|
int len_read;
|
||||||
char buf[12];
|
char buf[12];
|
||||||
|
unsigned long time;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
@ -293,11 +294,19 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
|
|||||||
else
|
else
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
|
time = get_timer(0);
|
||||||
len_read = fs_read(filename, addr, pos, bytes);
|
len_read = fs_read(filename, addr, pos, bytes);
|
||||||
|
time = get_timer(time);
|
||||||
if (len_read <= 0)
|
if (len_read <= 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
printf("%d bytes read\n", len_read);
|
printf("%d bytes read in %lu ms", len_read, time);
|
||||||
|
if (time > 0) {
|
||||||
|
puts(" (");
|
||||||
|
print_size(len_read / time * 1000, "/s");
|
||||||
|
puts(")");
|
||||||
|
}
|
||||||
|
puts("\n");
|
||||||
|
|
||||||
sprintf(buf, "0x%x", len_read);
|
sprintf(buf, "0x%x", len_read);
|
||||||
setenv("filesize", buf);
|
setenv("filesize", buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user