All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] common/cmd_ext_common: measure throughput
Date: Wed, 17 Oct 2012 11:58:30 +0200	[thread overview]
Message-ID: <1350467910-2014-1-git-send-email-andreas.devel@googlemail.com> (raw)

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@googlemail.com>
---
 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..57958e6 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_start;
 
 	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_start = 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_start = get_timer(time_start);
 
 	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_start);
+	if (time_start > 0) {
+		puts(" (");
+		print_size(filelen / time_start * 1000, "/s");
+		puts(")");
+	}
+	puts("\n");
 	sprintf(buf, "%X", filelen);
 	setenv("filesize", buf);
 
-- 
1.7.10.4

             reply	other threads:[~2012-10-17  9:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17  9:58 Andreas Bießmann [this message]
2012-10-17 10:05 ` [U-Boot] [PATCH] common/cmd_ext_common: measure throughput Wolfgang Denk
2012-10-17 10:16   ` Andreas Bießmann
2012-10-25 19:03     ` Tom Rini
2012-10-26  8:20 ` [U-Boot] [PATCH v2] " Andreas Bießmann
2012-10-30 11:49   ` [U-Boot] [PATCH v3] fs/fs.c: do_fsload: " Andreas Bießmann
2012-10-31  7:39     ` Andreas Bießmann
2012-11-04 18:00       ` Tom Rini
2012-11-14 12:59     ` Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350467910-2014-1-git-send-email-andreas.devel@googlemail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.