Patchwork [U-Boot,v3] fs/fs.c: do_fsload: measure throughput

login
register
mail settings
Submitter Andreas Bießmann
Date Oct. 30, 2012, 11:49 a.m.
Message ID <1351597766-30442-1-git-send-email-andreas.devel@googlemail.com>
Download mbox | patch
Permalink /patch/195465/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Andreas Bießmann - Oct. 30, 2012, 11:49 a.m.
This patch adds time measurement and throughput calculation for all supported
fsload 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>
---
since v1:
 * use 'time' instead of 'time_start' as suggested by Wolfgang

since v2:
 * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea
   Now there is some more overhead in the measurement caused by the respective
   fs-type functions (detect fs-type, eventually do mount and so on).
   Nevertheless I think such a measurement is good for further improvements
   like increasing throughput by whatever measures.

 fs/fs.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Andreas Bießmann - Oct. 31, 2012, 7:39 a.m.
Dear Tom Rini,

On 30.10.2012 12:49, Andreas Bießmann wrote:
> This patch adds time measurement and throughput calculation for all supported
> fsload 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>
> ---
> since v1:
>  * use 'time' instead of 'time_start' as suggested by Wolfgang
> 
> since v2:
>  * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea
>    Now there is some more overhead in the measurement caused by the respective
>    fs-type functions (detect fs-type, eventually do mount and so on).
>    Nevertheless I think such a measurement is good for further improvements
>    like increasing throughput by whatever measures.

I've just seen v3 is marked superseded in patchwork
(http://patchwork.ozlabs.org/patch/195465/), can you please tell why?

Best regards

Andreas Bießmann
Tom Rini - Nov. 4, 2012, 6 p.m.
On Wed, Oct 31, 2012 at 08:39:39AM +0100, Andreas Bie??mann wrote:
> Dear Tom Rini,
> 
> On 30.10.2012 12:49, Andreas Bie??mann wrote:
> > This patch adds time measurement and throughput calculation for all supported
> > fsload 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>
> > ---
> > since v1:
> >  * use 'time' instead of 'time_start' as suggested by Wolfgang
> > 
> > since v2:
> >  * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea
> >    Now there is some more overhead in the measurement caused by the respective
> >    fs-type functions (detect fs-type, eventually do mount and so on).
> >    Nevertheless I think such a measurement is good for further improvements
> >    like increasing throughput by whatever measures.
> 
> I've just seen v3 is marked superseded in patchwork
> (http://patchwork.ozlabs.org/patch/195465/), can you please tell why?

Too quick on the triage I guess, sorry, put back as New.
Anatolij Gustschin - Nov. 14, 2012, 12:59 p.m.
Hi,

On Tue, 30 Oct 2012 12:49:26 +0100
Andreas Bießmann <andreas.devel@googlemail.com> wrote:

> This patch adds time measurement and throughput calculation for all supported
> fsload 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>
> ---
> since v1:
>  * use 'time' instead of 'time_start' as suggested by Wolfgang
> 
> since v2:
>  * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea
>    Now there is some more overhead in the measurement caused by the respective
>    fs-type functions (detect fs-type, eventually do mount and so on).
>    Nevertheless I think such a measurement is good for further improvements
>    like increasing throughput by whatever measures.
> 
>  fs/fs.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Applied to staging/agust@denx.de after rebasing. Also slightly revised
commit log. Thanks!

Anatolij

Patch

diff --git a/fs/fs.c b/fs/fs.c
index 23ffa25..9f1cfed 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -246,6 +246,7 @@  int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	unsigned long pos;
 	int len_read;
 	char buf[12];
+	unsigned long time;
 
 	if (argc < 5)
 		return CMD_RET_USAGE;
@@ -280,11 +281,19 @@  int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	else
 		pos = 0;
 
+	time = get_timer(0);
 	len_read = fs_read(filename, addr, pos, bytes);
+	time = get_timer(time);
 	if (len_read <= 0)
 		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);
 	setenv("filesize", buf);