public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc_test: add some tests
@ 2011-02-08 11:41 Adrian Hunter
  2011-02-08 11:41 ` [PATCH 1/3] mmc_test: make performance test area size about 4MiB Adrian Hunter
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-02-08 11:41 UTC (permalink / raw)
  To: Chris Ball; +Cc: Adrian Hunter, linux-mmc Mailing List

Hi

Here are a couple of new performance tests for mmc-test.

Adrian Hunter (3):
      mmc_test: make performance test area size about 4MiB
      mmc_test: add tests to measure random I/O operations per second
      mmc_test: add tests to measure large sequential I/O performance

 drivers/mmc/card/mmc_test.c |  264 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 241 insertions(+), 23 deletions(-)

Regards
Adrian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] mmc_test: make performance test area size about 4MiB
  2011-02-08 11:41 [PATCH 0/3] mmc_test: add some tests Adrian Hunter
@ 2011-02-08 11:41 ` Adrian Hunter
  2011-02-08 11:41 ` [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second Adrian Hunter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-02-08 11:41 UTC (permalink / raw)
  To: Chris Ball; +Cc: Adrian Hunter, linux-mmc Mailing List

The test area size was set to the preferred erase size
but for comparison purposes it is better if it is the
same size for different devices.  Make it a multiple
of preferred erase size that is greater than or equal
to 4MiB.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mmc/card/mmc_test.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 0131c6c..ec6060c 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1426,28 +1426,29 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
 }
 
 /*
- * Initialize an area for testing large transfers.  The size of the area is the
- * preferred erase size which is a good size for optimal transfer speed.  Note
- * that is typically 4MiB for modern cards.  The test area is set to the middle
- * of the card because cards may have different charateristics at the front
- * (for FAT file system optimization).  Optionally, the area is erased (if the
- * card supports it) which may improve write performance.  Optionally, the area
- * is filled with data for subsequent read tests.
+ * Initialize an area for testing large transfers.  The test area is set to the
+ * middle of the card because cards may have different charateristics at the
+ * front (for FAT file system optimization).  Optionally, the area is erased
+ * (if the card supports it) which may improve write performance.  Optionally,
+ * the area is filled with data for subsequent read tests.
  */
 static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
 {
 	struct mmc_test_area *t = &test->area;
-	unsigned long min_sz = 64 * 1024;
+	unsigned long min_sz = 64 * 1024, sz;
 	int ret;
 
 	ret = mmc_test_set_blksize(test, 512);
 	if (ret)
 		return ret;
 
-	if (test->card->pref_erase > TEST_AREA_MAX_SIZE >> 9)
-		t->max_sz = TEST_AREA_MAX_SIZE;
-	else
-		t->max_sz = (unsigned long)test->card->pref_erase << 9;
+	/* Make the test area size about 4MiB */
+	sz = (unsigned long)test->card->pref_erase << 9;
+	t->max_sz = sz;
+	while (t->max_sz < 4 * 1024 * 1024)
+		t->max_sz += sz;
+	while (t->max_sz > TEST_AREA_MAX_SIZE && t->max_sz > sz)
+		t->max_sz -= sz;
 
 	t->max_segs = test->card->host->max_segs;
 	t->max_seg_sz = test->card->host->max_seg_size;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second
  2011-02-08 11:41 [PATCH 0/3] mmc_test: add some tests Adrian Hunter
  2011-02-08 11:41 ` [PATCH 1/3] mmc_test: make performance test area size about 4MiB Adrian Hunter
@ 2011-02-08 11:41 ` Adrian Hunter
  2011-03-30 10:56   ` Keshava Munegowda
  2011-02-08 11:41 ` [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance Adrian Hunter
  2011-02-08 15:45 ` [PATCH 0/3] mmc_test: add some tests Chris Ball
  3 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2011-02-08 11:41 UTC (permalink / raw)
  To: Chris Ball; +Cc: Adrian Hunter, linux-mmc Mailing List

Existing performance tests measure single or sequential I/O speed.
Add two random I/O tests:
        33. Random read performance by transfer size
        34. Random write performance by transfer size

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mmc/card/mmc_test.c |  139 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 128 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index ec6060c..d1aa57a 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -88,6 +88,7 @@ struct mmc_test_area {
  * @sectors: amount of sectors to check in one group
  * @ts: time values of transfer
  * @rate: calculated transfer rate
+ * @iops: I/O operations per second (times 100)
  */
 struct mmc_test_transfer_result {
 	struct list_head link;
@@ -95,6 +96,7 @@ struct mmc_test_transfer_result {
 	unsigned int sectors;
 	struct timespec ts;
 	unsigned int rate;
+	unsigned int iops;
 };
 
 /**
@@ -495,7 +497,7 @@ static unsigned int mmc_test_rate(uint64_t bytes, struct timespec *ts)
  */
 static void mmc_test_save_transfer_result(struct mmc_test_card *test,
 	unsigned int count, unsigned int sectors, struct timespec ts,
-	unsigned int rate)
+	unsigned int rate, unsigned int iops)
 {
 	struct mmc_test_transfer_result *tr;
 
@@ -510,6 +512,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
 	tr->sectors = sectors;
 	tr->ts = ts;
 	tr->rate = rate;
+	tr->iops = iops;
 
 	list_add_tail(&tr->link, &test->gr->tr_lst);
 }
@@ -520,20 +523,22 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
 static void mmc_test_print_rate(struct mmc_test_card *test, uint64_t bytes,
 				struct timespec *ts1, struct timespec *ts2)
 {
-	unsigned int rate, sectors = bytes >> 9;
+	unsigned int rate, iops, sectors = bytes >> 9;
 	struct timespec ts;
 
 	ts = timespec_sub(*ts2, *ts1);
 
 	rate = mmc_test_rate(bytes, &ts);
+	iops = mmc_test_rate(100, &ts); /* I/O ops per sec x 100 */
 
 	printk(KERN_INFO "%s: Transfer of %u sectors (%u%s KiB) took %lu.%09lu "
-			 "seconds (%u kB/s, %u KiB/s)\n",
+			 "seconds (%u kB/s, %u KiB/s, %u.%02u IOPS)\n",
 			 mmc_hostname(test->card->host), sectors, sectors >> 1,
 			 (sectors & 1 ? ".5" : ""), (unsigned long)ts.tv_sec,
-			 (unsigned long)ts.tv_nsec, rate / 1000, rate / 1024);
+			 (unsigned long)ts.tv_nsec, rate / 1000, rate / 1024,
+			 iops / 100, iops % 100);
 
-	mmc_test_save_transfer_result(test, 1, sectors, ts, rate);
+	mmc_test_save_transfer_result(test, 1, sectors, ts, rate, iops);
 }
 
 /*
@@ -543,22 +548,24 @@ static void mmc_test_print_avg_rate(struct mmc_test_card *test, uint64_t bytes,
 				    unsigned int count, struct timespec *ts1,
 				    struct timespec *ts2)
 {
-	unsigned int rate, sectors = bytes >> 9;
+	unsigned int rate, iops, sectors = bytes >> 9;
 	uint64_t tot = bytes * count;
 	struct timespec ts;
 
 	ts = timespec_sub(*ts2, *ts1);
 
 	rate = mmc_test_rate(tot, &ts);
+	iops = mmc_test_rate(count * 100, &ts); /* I/O ops per sec x 100 */
 
 	printk(KERN_INFO "%s: Transfer of %u x %u sectors (%u x %u%s KiB) took "
-			 "%lu.%09lu seconds (%u kB/s, %u KiB/s)\n",
+			 "%lu.%09lu seconds (%u kB/s, %u KiB/s, "
+			 "%u.%02u IOPS)\n",
 			 mmc_hostname(test->card->host), count, sectors, count,
 			 sectors >> 1, (sectors & 1 ? ".5" : ""),
 			 (unsigned long)ts.tv_sec, (unsigned long)ts.tv_nsec,
-			 rate / 1000, rate / 1024);
+			 rate / 1000, rate / 1024, iops / 100, iops % 100);
 
-	mmc_test_save_transfer_result(test, count, sectors, ts, rate);
+	mmc_test_save_transfer_result(test, count, sectors, ts, rate, iops);
 }
 
 /*
@@ -1768,6 +1775,102 @@ static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test)
 	return 0;
 }
 
+static unsigned int rnd_next = 1;
+
+static unsigned int mmc_test_rnd_num(unsigned int rnd_cnt)
+{
+	uint64_t r;
+
+	rnd_next = rnd_next * 1103515245 + 12345;
+	r = (rnd_next >> 16) & 0x7fff;
+	return (r * rnd_cnt) >> 15;
+}
+
+static int mmc_test_rnd_perf(struct mmc_test_card *test, int write, int print,
+			     unsigned long sz)
+{
+	unsigned int dev_addr, cnt, rnd_addr, range1, range2, last_ea = 0, ea;
+	unsigned int ssz;
+	struct timespec ts1, ts2, ts;
+	int ret;
+
+	ssz = sz >> 9;
+
+	rnd_addr = mmc_test_capacity(test->card) / 4;
+	range1 = rnd_addr / test->card->pref_erase;
+	range2 = range1 / ssz;
+
+	getnstimeofday(&ts1);
+	for (cnt = 0; cnt < UINT_MAX; cnt++) {
+		getnstimeofday(&ts2);
+		ts = timespec_sub(ts2, ts1);
+		if (ts.tv_sec >= 10)
+			break;
+		ea = mmc_test_rnd_num(range1);
+		if (ea == last_ea)
+			ea -= 1;
+		last_ea = ea;
+		dev_addr = rnd_addr + test->card->pref_erase * ea +
+			   ssz * mmc_test_rnd_num(range2);
+		ret = mmc_test_area_io(test, sz, dev_addr, write, 0, 0);
+		if (ret)
+			return ret;
+	}
+	if (print)
+		mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2);
+	return 0;
+}
+
+static int mmc_test_random_perf(struct mmc_test_card *test, int write)
+{
+	unsigned int next;
+	unsigned long sz;
+	int ret;
+
+	for (sz = 512; sz < test->area.max_tfr; sz <<= 1) {
+		/*
+		 * When writing, try to get more consistent results by running
+		 * the test twice with exactly the same I/O but outputting the
+		 * results only for the 2nd run.
+		 */
+		if (write) {
+			next = rnd_next;
+			ret = mmc_test_rnd_perf(test, write, 0, sz);
+			if (ret)
+				return ret;
+			rnd_next = next;
+		}
+		ret = mmc_test_rnd_perf(test, write, 1, sz);
+		if (ret)
+			return ret;
+	}
+	sz = test->area.max_tfr;
+	if (write) {
+		next = rnd_next;
+		ret = mmc_test_rnd_perf(test, write, 0, sz);
+		if (ret)
+			return ret;
+		rnd_next = next;
+	}
+	return mmc_test_rnd_perf(test, write, 1, sz);
+}
+
+/*
+ * Random read performance by transfer size.
+ */
+static int mmc_test_random_read_perf(struct mmc_test_card *test)
+{
+	return mmc_test_random_perf(test, 0);
+}
+
+/*
+ * Random write performance by transfer size.
+ */
+static int mmc_test_random_write_perf(struct mmc_test_card *test)
+{
+	return mmc_test_random_perf(test, 1);
+}
+
 static const struct mmc_test_case mmc_test_cases[] = {
 	{
 		.name = "Basic write (no data verification)",
@@ -2007,6 +2110,20 @@ static const struct mmc_test_case mmc_test_cases[] = {
 		.cleanup = mmc_test_area_cleanup,
 	},
 
+	{
+		.name = "Random read performance by transfer size",
+		.prepare = mmc_test_area_prepare,
+		.run = mmc_test_random_read_perf,
+		.cleanup = mmc_test_area_cleanup,
+	},
+
+	{
+		.name = "Random write performance by transfer size",
+		.prepare = mmc_test_area_prepare,
+		.run = mmc_test_random_write_perf,
+		.cleanup = mmc_test_area_cleanup,
+	},
+
 };
 
 static DEFINE_MUTEX(mmc_test_lock);
@@ -2150,11 +2267,11 @@ static int mtf_test_show(struct seq_file *sf, void *data)
 		seq_printf(sf, "Test %d: %d\n", gr->testcase + 1, gr->result);
 
 		list_for_each_entry(tr, &gr->tr_lst, link) {
-			seq_printf(sf, "%u %d %lu.%09lu %u\n",
+			seq_printf(sf, "%u %d %lu.%09lu %u %u.%02u\n",
 				tr->count, tr->sectors,
 				(unsigned long)tr->ts.tv_sec,
 				(unsigned long)tr->ts.tv_nsec,
-				tr->rate);
+				tr->rate, tr->iops / 100, tr->iops % 100);
 		}
 	}
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance
  2011-02-08 11:41 [PATCH 0/3] mmc_test: add some tests Adrian Hunter
  2011-02-08 11:41 ` [PATCH 1/3] mmc_test: make performance test area size about 4MiB Adrian Hunter
  2011-02-08 11:41 ` [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second Adrian Hunter
@ 2011-02-08 11:41 ` Adrian Hunter
  2011-03-30 10:57   ` Keshava Munegowda
  2011-02-08 15:45 ` [PATCH 0/3] mmc_test: add some tests Chris Ball
  3 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2011-02-08 11:41 UTC (permalink / raw)
  To: Chris Ball; +Cc: Adrian Hunter, linux-mmc Mailing List

Add two large sequential I/O performance tests:
        35. Large sequential read into scattered pages
        36. Large sequential write from scattered pages

The tests measure transfer times for 10MiB, 100MiB, 1000MiB.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mmc/card/mmc_test.c |  100 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 100 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index d1aa57a..5ec8edd 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1871,6 +1871,92 @@ static int mmc_test_random_write_perf(struct mmc_test_card *test)
 	return mmc_test_random_perf(test, 1);
 }
 
+static int mmc_test_seq_perf(struct mmc_test_card *test, int write,
+			     unsigned int tot_sz, int max_scatter)
+{
+	unsigned int dev_addr, i, cnt, sz, ssz;
+	struct timespec ts1, ts2, ts;
+	int ret;
+
+	sz = test->area.max_tfr;
+	/*
+	 * In the case of a maximally scattered transfer, the maximum transfer
+	 * size is further limited by using PAGE_SIZE segments.
+	 */
+	if (max_scatter) {
+		struct mmc_test_area *t = &test->area;
+		unsigned long max_tfr;
+
+		if (t->max_seg_sz >= PAGE_SIZE)
+			max_tfr = t->max_segs * PAGE_SIZE;
+		else
+			max_tfr = t->max_segs * t->max_seg_sz;
+		if (sz > max_tfr)
+			sz = max_tfr;
+	}
+
+	ssz = sz >> 9;
+	dev_addr = mmc_test_capacity(test->card) / 4;
+	if (tot_sz > dev_addr << 9)
+		tot_sz = dev_addr << 9;
+	cnt = tot_sz / sz;
+	dev_addr &= 0xffff0000; /* Round to 64MiB boundary */
+
+	getnstimeofday(&ts1);
+	for (i = 0; i < cnt; i++) {
+		ret = mmc_test_area_io(test, sz, dev_addr, write,
+				       max_scatter, 0);
+		if (ret)
+			return ret;
+		dev_addr += ssz;
+	}
+	getnstimeofday(&ts2);
+
+	ts = timespec_sub(ts2, ts1);
+	mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2);
+
+	return 0;
+}
+
+static int mmc_test_large_seq_perf(struct mmc_test_card *test, int write)
+{
+	int ret, i;
+
+	for (i = 0; i < 10; i++) {
+		ret = mmc_test_seq_perf(test, write, 10 * 1024 * 1024, 1);
+		if (ret)
+			return ret;
+	}
+	for (i = 0; i < 5; i++) {
+		ret = mmc_test_seq_perf(test, write, 100 * 1024 * 1024, 1);
+		if (ret)
+			return ret;
+	}
+	for (i = 0; i < 3; i++) {
+		ret = mmc_test_seq_perf(test, write, 1000 * 1024 * 1024, 1);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
+
+/*
+ * Large sequential read performance.
+ */
+static int mmc_test_large_seq_read_perf(struct mmc_test_card *test)
+{
+	return mmc_test_large_seq_perf(test, 0);
+}
+
+/*
+ * Large sequential write performance.
+ */
+static int mmc_test_large_seq_write_perf(struct mmc_test_card *test)
+{
+	return mmc_test_large_seq_perf(test, 1);
+}
+
 static const struct mmc_test_case mmc_test_cases[] = {
 	{
 		.name = "Basic write (no data verification)",
@@ -2124,6 +2210,20 @@ static const struct mmc_test_case mmc_test_cases[] = {
 		.cleanup = mmc_test_area_cleanup,
 	},
 
+	{
+		.name = "Large sequential read into scattered pages",
+		.prepare = mmc_test_area_prepare,
+		.run = mmc_test_large_seq_read_perf,
+		.cleanup = mmc_test_area_cleanup,
+	},
+
+	{
+		.name = "Large sequential write from scattered pages",
+		.prepare = mmc_test_area_prepare,
+		.run = mmc_test_large_seq_write_perf,
+		.cleanup = mmc_test_area_cleanup,
+	},
+
 };
 
 static DEFINE_MUTEX(mmc_test_lock);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmc_test: add some tests
  2011-02-08 11:41 [PATCH 0/3] mmc_test: add some tests Adrian Hunter
                   ` (2 preceding siblings ...)
  2011-02-08 11:41 ` [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance Adrian Hunter
@ 2011-02-08 15:45 ` Chris Ball
  3 siblings, 0 replies; 7+ messages in thread
From: Chris Ball @ 2011-02-08 15:45 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc Mailing List

Hi Adrian,

On Tue, Feb 08, 2011 at 01:41:00PM +0200, Adrian Hunter wrote:
> Hi
> 
> Here are a couple of new performance tests for mmc-test.
> 
> Adrian Hunter (3):
>       mmc_test: make performance test area size about 4MiB
>       mmc_test: add tests to measure random I/O operations per second
>       mmc_test: add tests to measure large sequential I/O performance

Thanks very much, pushed to mmc-next for .39.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second
  2011-02-08 11:41 ` [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second Adrian Hunter
@ 2011-03-30 10:56   ` Keshava Munegowda
  0 siblings, 0 replies; 7+ messages in thread
From: Keshava Munegowda @ 2011-03-30 10:56 UTC (permalink / raw)
  To: Adrian Hunter, Chris Ball; +Cc: linux-mmc Mailing List

> +
> +static int mmc_test_rnd_perf(struct mmc_test_card *test, int write, int
print,
> +			     unsigned long sz)
> +{
> +	unsigned int dev_addr, cnt, rnd_addr, range1, range2, last_ea = 0,
ea;
> +	unsigned int ssz;
> +	struct timespec ts1, ts2, ts;
> +	int ret;
> +

Tabify all you declarations here.

> +	ssz = sz >> 9;
> +
> +	rnd_addr = mmc_test_capacity(test->card) / 4;
> +	range1 = rnd_addr / test->card->pref_erase;
> +	range2 = range1 / ssz;
> +
> +	getnstimeofday(&ts1);
> +	for (cnt = 0; cnt < UINT_MAX; cnt++) {
> +		getnstimeofday(&ts2);
> +		ts = timespec_sub(ts2, ts1);
> +		if (ts.tv_sec >= 10)
> +			break;
> +		ea = mmc_test_rnd_num(range1);
> +		if (ea == last_ea)
> +			ea -= 1;
> +		last_ea = ea;
> +		dev_addr = rnd_addr + test->card->pref_erase * ea +
> +			   ssz * mmc_test_rnd_num(range2);
> +		ret = mmc_test_area_io(test, sz, dev_addr, write, 0, 0);
> +		if (ret)
> +			return ret;
> +	}
> +	if (print)
> +		mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2);
> +	return 0;
> +}
> +
> +static int mmc_test_random_perf(struct mmc_test_card *test, int write)
> +{
> +	unsigned int next;
> +	unsigned long sz;
> +	int ret;
> +
> +	for (sz = 512; sz < test->area.max_tfr; sz <<= 1) {
> +		/*
> +		 * When writing, try to get more consistent results by
running
> +		 * the test twice with exactly the same I/O but outputting
the
> +		 * results only for the 2nd run.
> +		 */
> +		if (write) {
> +			next = rnd_next;
> +			ret = mmc_test_rnd_perf(test, write, 0, sz);
> +			if (ret)
> +				return ret;
> +			rnd_next = next;
> +		}
> +		ret = mmc_test_rnd_perf(test, write, 1, sz);
> +		if (ret)
> +			return ret;
> +	}
> +	sz = test->area.max_tfr;
> +	if (write) {
> +		next = rnd_next;
> +		ret = mmc_test_rnd_perf(test, write, 0, sz);
> +		if (ret)
> +			return ret;
> +		rnd_next = next;
> +	}
> +	return mmc_test_rnd_perf(test, write, 1, sz);
> +}
> +
> +/*
> + * Random read performance by transfer size.
> + */
> +static int mmc_test_random_read_perf(struct mmc_test_card *test)
> +{
> +	return mmc_test_random_perf(test, 0);
> +}
> +
> +/*
> + * Random write performance by transfer size.
> + */
> +static int mmc_test_random_write_perf(struct mmc_test_card *test)
> +{
> +	return mmc_test_random_perf(test, 1);
> +}
> +
>  static const struct mmc_test_case mmc_test_cases[] = {
>  	{
>  		.name = "Basic write (no data verification)",
> @@ -2007,6 +2110,20 @@ static const struct mmc_test_case
mmc_test_cases[] = {
>  		.cleanup = mmc_test_area_cleanup,
>  	},
>
> +	{
> +		.name = "Random read performance by transfer size",
> +		.prepare = mmc_test_area_prepare,
> +		.run = mmc_test_random_read_perf,
> +		.cleanup = mmc_test_area_cleanup,
> +	},
> +
> +	{
> +		.name = "Random write performance by transfer size",
> +		.prepare = mmc_test_area_prepare,
> +		.run = mmc_test_random_write_perf,
> +		.cleanup = mmc_test_area_cleanup,
> +	},
> +
>  };
>
>  static DEFINE_MUTEX(mmc_test_lock);
> @@ -2150,11 +2267,11 @@ static int mtf_test_show(struct seq_file *sf,
void *data)
>  		seq_printf(sf, "Test %d: %d\n", gr->testcase + 1,
gr->result);
>
>  		list_for_each_entry(tr, &gr->tr_lst, link) {
> -			seq_printf(sf, "%u %d %lu.%09lu %u\n",
> +			seq_printf(sf, "%u %d %lu.%09lu %u %u.%02u\n",
>  				tr->count, tr->sectors,
>  				(unsigned long)tr->ts.tv_sec,
>  				(unsigned long)tr->ts.tv_nsec,
> -				tr->rate);
> +				tr->rate, tr->iops / 100, tr->iops % 100);
>  		}
>  	}
>
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance
  2011-02-08 11:41 ` [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance Adrian Hunter
@ 2011-03-30 10:57   ` Keshava Munegowda
  0 siblings, 0 replies; 7+ messages in thread
From: Keshava Munegowda @ 2011-03-30 10:57 UTC (permalink / raw)
  To: Adrian Hunter, Chris Ball; +Cc: linux-mmc Mailing List

> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org
[mailto:linux-mmc-owner@vger.kernel.org] On Behalf Of Adrian
> Hunter
> Sent: Tuesday, February 08, 2011 5:11 PM
> To: Chris Ball
> Cc: Adrian Hunter; linux-mmc Mailing List
> Subject: [PATCH 3/3] mmc_test: add tests to measure large sequential I/O
performance
>
> Add two large sequential I/O performance tests:
>         35. Large sequential read into scattered pages
>         36. Large sequential write from scattered pages
>
> The tests measure transfer times for 10MiB, 100MiB, 1000MiB.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---
>  drivers/mmc/card/mmc_test.c |  100
+++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 100 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index d1aa57a..5ec8edd 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -1871,6 +1871,92 @@ static int mmc_test_random_write_perf(struct
mmc_test_card *test)
>  	return mmc_test_random_perf(test, 1);
>  }
>
> +static int mmc_test_seq_perf(struct mmc_test_card *test, int write,
> +			     unsigned int tot_sz, int max_scatter)
> +{
> +	unsigned int dev_addr, i, cnt, sz, ssz;
> +	struct timespec ts1, ts2, ts;
> +	int ret;

Tabify all variable declarations.


> +
> +	sz = test->area.max_tfr;
> +	/*
> +	 * In the case of a maximally scattered transfer, the maximum
transfer
> +	 * size is further limited by using PAGE_SIZE segments.
> +	 */
> +	if (max_scatter) {
> +		struct mmc_test_area *t = &test->area;
> +		unsigned long max_tfr;
> +
> +		if (t->max_seg_sz >= PAGE_SIZE)
> +			max_tfr = t->max_segs * PAGE_SIZE;
> +		else
> +			max_tfr = t->max_segs * t->max_seg_sz;
> +		if (sz > max_tfr)
> +			sz = max_tfr;
> +	}
> +
> +	ssz = sz >> 9;
> +	dev_addr = mmc_test_capacity(test->card) / 4;
> +	if (tot_sz > dev_addr << 9)
> +		tot_sz = dev_addr << 9;
> +	cnt = tot_sz / sz;
> +	dev_addr &= 0xffff0000; /* Round to 64MiB boundary */
> +
> +	getnstimeofday(&ts1);
> +	for (i = 0; i < cnt; i++) {
> +		ret = mmc_test_area_io(test, sz, dev_addr, write,
> +				       max_scatter, 0);
> +		if (ret)
> +			return ret;
> +		dev_addr += ssz;
> +	}
> +	getnstimeofday(&ts2);
> +
> +	ts = timespec_sub(ts2, ts1);
> +	mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2);
> +
> +	return 0;
> +}
> +
> +static int mmc_test_large_seq_perf(struct mmc_test_card *test, int
write)
> +{
> +	int ret, i;
> +
> +	for (i = 0; i < 10; i++) {
> +		ret = mmc_test_seq_perf(test, write, 10 * 1024 * 1024, 1);
> +		if (ret)
> +			return ret;
> +	}
> +	for (i = 0; i < 5; i++) {
> +		ret = mmc_test_seq_perf(test, write, 100 * 1024 * 1024,
1);
> +		if (ret)
> +			return ret;
> +	}
> +	for (i = 0; i < 3; i++) {
> +		ret = mmc_test_seq_perf(test, write, 1000 * 1024 * 1024,
1);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +/*
> + * Large sequential read performance.
> + */
> +static int mmc_test_large_seq_read_perf(struct mmc_test_card *test)
> +{
> +	return mmc_test_large_seq_perf(test, 0);
> +}
> +
> +/*
> + * Large sequential write performance.
> + */
> +static int mmc_test_large_seq_write_perf(struct mmc_test_card *test)
> +{
> +	return mmc_test_large_seq_perf(test, 1);
> +}
> +
>  static const struct mmc_test_case mmc_test_cases[] = {
>  	{
>  		.name = "Basic write (no data verification)",
> @@ -2124,6 +2210,20 @@ static const struct mmc_test_case
mmc_test_cases[] = {
>  		.cleanup = mmc_test_area_cleanup,
>  	},
>
> +	{
> +		.name = "Large sequential read into scattered pages",
> +		.prepare = mmc_test_area_prepare,
> +		.run = mmc_test_large_seq_read_perf,
> +		.cleanup = mmc_test_area_cleanup,
> +	},
> +
> +	{
> +		.name = "Large sequential write from scattered pages",
> +		.prepare = mmc_test_area_prepare,
> +		.run = mmc_test_large_seq_write_perf,
> +		.cleanup = mmc_test_area_cleanup,
> +	},
> +
>  };
>
>  static DEFINE_MUTEX(mmc_test_lock);
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-30 10:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08 11:41 [PATCH 0/3] mmc_test: add some tests Adrian Hunter
2011-02-08 11:41 ` [PATCH 1/3] mmc_test: make performance test area size about 4MiB Adrian Hunter
2011-02-08 11:41 ` [PATCH 2/3] mmc_test: add tests to measure random I/O operations per second Adrian Hunter
2011-03-30 10:56   ` Keshava Munegowda
2011-02-08 11:41 ` [PATCH 3/3] mmc_test: add tests to measure large sequential I/O performance Adrian Hunter
2011-03-30 10:57   ` Keshava Munegowda
2011-02-08 15:45 ` [PATCH 0/3] mmc_test: add some tests Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox