From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Cc: Tom Rini <trini@konsulko.com>,
Michael Trimarchi <michael@amarulasolutions.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Christian Marangi <ansuelsmth@gmail.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH] cmd: mtd: fix speed measurement in the speed benchmark
Date: Tue, 26 Aug 2025 16:23:27 +0200 [thread overview]
Message-ID: <87h5xu2mcg.fsf@bootlin.com> (raw)
In-Reply-To: <20250825234829.155483-1-mikhail.kshevetskiy@iopsys.eu> (Mikhail Kshevetskiy's message of "Tue, 26 Aug 2025 02:48:29 +0300")
Hello Mikhail,
On 26/08/2025 at 02:48:29 +03, Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> wrote:
> The shown speed inverse linearly depends on size of data.
> See the output:
>
> spi-nand: spi_nand nand@0: Micron SPI NAND was found.
> spi-nand: spi_nand nand@0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
> ...
> => mtd read.benchmark spi-nand0 $loadaddr 0 0x40000
> Reading 262144 byte(s) (128 page(s)) at offset 0x00000000
> Read speed: 63kiB/s
> => mtd read.benchmark spi-nand0 $loadaddr 0 0x20000
> Reading 131072 byte(s) (64 page(s)) at offset 0x00000000
> Read speed: 127kiB/s
> => mtd read.benchmark spi-nand0 $loadaddr 0 0x10000
> Reading 65536 byte(s) (32 page(s)) at offset 0x00000000
> Read speed: 254kiB/s
>
> In the spi-nand case 'io_op.len' is not the same as 'len',
> thus we divide a size of the single block on total time.
> This is wrong, we should divide on the time for a single
> block.
>
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Happy to see this is useful :-) But you're totally right, it didn't use
the correct length. Maybe I would rephrase a bit the last two sentences
to make the commit clearer:
"In the spi-nand case 'io_op.len' is not always the same as 'len', thus
we are using the wrong amount of data to derive the speed."
However, regarding the diff,
> @@ -594,9 +594,10 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
>
> if (benchmark && bench_start) {
> bench_end = timer_get_us();
> + block_time = (bench_end - bench_start) / (len / io_op.len);
> printf("%s speed: %lukiB/s\n",
> read ? "Read" : "Write",
> - ((io_op.len * 1000000) / (bench_end - bench_start)) / 1024);
> + ((io_op.len * 1000000) / block_time) / 1024);
Why not just dividing the length by the benchmark time instead of
reducing and rounding the denominator in the first place, which I
believe makes the final result less precise?
Thanks,
Miquèl
next prev parent reply other threads:[~2025-08-26 18:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 23:48 [PATCH] cmd: mtd: fix speed measurement in the speed benchmark Mikhail Kshevetskiy
2025-08-26 14:23 ` Miquel Raynal [this message]
2025-08-26 14:32 ` Michael Nazzareno Trimarchi
2025-08-26 14:35 ` Mikhail Kshevetskiy
2025-08-26 14:33 ` Mikhail Kshevetskiy
2025-08-26 14:59 ` Miquel Raynal
2025-08-26 19:21 ` [PATCH v2] " Mikhail Kshevetskiy
2025-08-28 9:45 ` Miquel Raynal
2025-08-29 7:48 ` [PATCH v3 0/2] cmd: mtd: fix benchmarking Mikhail Kshevetskiy
2025-08-29 7:48 ` [PATCH v3 1/2] cmd: mtd: fix speed measurement in the speed benchmark Mikhail Kshevetskiy
2025-08-29 7:48 ` [PATCH v3 2/2] cmd: mtd: add benchmark option to the help Mikhail Kshevetskiy
2025-08-29 7:55 ` [PATCH v4 0/2] cmd: mtd: fix benchmarking Mikhail Kshevetskiy
2025-08-29 7:55 ` [PATCH v4 1/2] Prepare v2025.10-rc3 Mikhail Kshevetskiy
2025-08-29 7:55 ` [PATCH v4 2/2] cmd: mtd: fix speed measurement in the speed benchmark Mikhail Kshevetskiy
2025-08-29 7:59 ` [PATCH v5 0/2] cmd: mtd: fix benchmarking Mikhail Kshevetskiy
2025-08-29 7:59 ` [PATCH v5 1/2] cmd: mtd: fix speed measurement in the speed benchmark Mikhail Kshevetskiy
2025-08-29 7:59 ` [PATCH v5 2/2] cmd: mtd: add benchmark option to the help Mikhail Kshevetskiy
2025-08-29 21:54 ` Miquel Raynal
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=87h5xu2mcg.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=ansuelsmth@gmail.com \
--cc=michael@amarulasolutions.com \
--cc=mikhail.kshevetskiy@iopsys.eu \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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