From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spi: sf: add support for throughput mesurement of sf read/write
Date: Thu, 17 Dec 2015 12:33:24 +0530 [thread overview]
Message-ID: <56725E3C.7040609@ti.com> (raw)
In-Reply-To: <1445954063-29943-1-git-send-email-mugunthanvnm@ti.com>
Jagan
On Tuesday 27 October 2015 07:24 PM, Mugunthan V N wrote:
> This patch adds time measurement and throughput calculation for
> sf read/write commands.
>
> The output of sf read changes from
>
> ---8<---
> SF: 4096 bytes @ 0x0 Read: OK
> --->8---
>
> to
>
> ---8<---
> SF: 4096 bytes @ 0x0 Read: OK in 6 ms (666 KiB/s)
> --->8---
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
A gentle ping
Regards
Mugunthan V N
> ---
> common/cmd_sf.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index ac7f5df..8687f3a 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -15,6 +15,7 @@
> #include <spi_flash.h>
> #include <jffs2/jffs2.h>
> #include <linux/mtd/mtd.h>
> +#include <linux/math64.h>
>
> #include <asm/io.h>
> #include <dm/device-internal.h>
> @@ -266,6 +267,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
> int ret = 1;
> int dev = 0;
> loff_t offset, len, maxsize;
> + unsigned long time;
>
> if (argc < 3)
> return -1;
> @@ -298,17 +300,27 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
> int read;
>
> read = strncmp(argv[0], "read", 4) == 0;
> +
> + time = get_timer(0);
> if (read)
> ret = spi_flash_read(flash, offset, len, buf);
> else
> ret = spi_flash_write(flash, offset, len, buf);
> + time = get_timer(time);
>
> printf("SF: %zu bytes @ %#x %s: ", (size_t)len, (u32)offset,
> read ? "Read" : "Written");
> - if (ret)
> + if (ret) {
> printf("ERROR %d\n", ret);
> - else
> - printf("OK\n");
> + } else {
> + printf("OK in %lu ms", time);
> + if (time > 0) {
> + puts(" (");
> + print_size(div_u64(len, time) * 1000, "/s");
> + puts(")");
> + }
> + puts("\n");
> + }
> }
>
> unmap_physmem(buf, len);
>
next prev parent reply other threads:[~2015-12-17 7:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 13:54 [U-Boot] [PATCH] spi: sf: add support for throughput mesurement of sf read/write Mugunthan V N
2015-12-17 7:03 ` Mugunthan V N [this message]
2015-12-17 7:13 ` Jagan Teki
2015-12-17 7:56 ` Mugunthan V N
2015-12-17 16:44 ` Jagan Teki
2015-12-18 6:07 ` Stefan Roese
2015-12-21 5:37 ` Mugunthan V N
2015-12-21 6:00 ` Stefan Roese
2015-12-21 6:07 ` Jagan Teki
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=56725E3C.7040609@ti.com \
--to=mugunthanvnm@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox