> + > +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@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html