diff options
author | Adrian Hunter <adrian.hunter@nokia.com> | 2011-02-08 06:41:03 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-03-15 13:48:44 -0400 |
commit | a803d551d92079beb599cc37fa407c059c82c821 (patch) | |
tree | 86faf78b3938ca4cf201a3e94bde7cd025374ace /drivers/mmc/card | |
parent | b6056d12342f936256cbf64c86459af06f11cd5e (diff) |
mmc: 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>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | 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 d1aa57a4d058..5ec8eddfcf6e 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) | |||
1871 | return mmc_test_random_perf(test, 1); | 1871 | return mmc_test_random_perf(test, 1); |
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | static int mmc_test_seq_perf(struct mmc_test_card *test, int write, | ||
1875 | unsigned int tot_sz, int max_scatter) | ||
1876 | { | ||
1877 | unsigned int dev_addr, i, cnt, sz, ssz; | ||
1878 | struct timespec ts1, ts2, ts; | ||
1879 | int ret; | ||
1880 | |||
1881 | sz = test->area.max_tfr; | ||
1882 | /* | ||
1883 | * In the case of a maximally scattered transfer, the maximum transfer | ||
1884 | * size is further limited by using PAGE_SIZE segments. | ||
1885 | */ | ||
1886 | if (max_scatter) { | ||
1887 | struct mmc_test_area *t = &test->area; | ||
1888 | unsigned long max_tfr; | ||
1889 | |||
1890 | if (t->max_seg_sz >= PAGE_SIZE) | ||
1891 | max_tfr = t->max_segs * PAGE_SIZE; | ||
1892 | else | ||
1893 | max_tfr = t->max_segs * t->max_seg_sz; | ||
1894 | if (sz > max_tfr) | ||
1895 | sz = max_tfr; | ||
1896 | } | ||
1897 | |||
1898 | ssz = sz >> 9; | ||
1899 | dev_addr = mmc_test_capacity(test->card) / 4; | ||
1900 | if (tot_sz > dev_addr << 9) | ||
1901 | tot_sz = dev_addr << 9; | ||
1902 | cnt = tot_sz / sz; | ||
1903 | dev_addr &= 0xffff0000; /* Round to 64MiB boundary */ | ||
1904 | |||
1905 | getnstimeofday(&ts1); | ||
1906 | for (i = 0; i < cnt; i++) { | ||
1907 | ret = mmc_test_area_io(test, sz, dev_addr, write, | ||
1908 | max_scatter, 0); | ||
1909 | if (ret) | ||
1910 | return ret; | ||
1911 | dev_addr += ssz; | ||
1912 | } | ||
1913 | getnstimeofday(&ts2); | ||
1914 | |||
1915 | ts = timespec_sub(ts2, ts1); | ||
1916 | mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); | ||
1917 | |||
1918 | return 0; | ||
1919 | } | ||
1920 | |||
1921 | static int mmc_test_large_seq_perf(struct mmc_test_card *test, int write) | ||
1922 | { | ||
1923 | int ret, i; | ||
1924 | |||
1925 | for (i = 0; i < 10; i++) { | ||
1926 | ret = mmc_test_seq_perf(test, write, 10 * 1024 * 1024, 1); | ||
1927 | if (ret) | ||
1928 | return ret; | ||
1929 | } | ||
1930 | for (i = 0; i < 5; i++) { | ||
1931 | ret = mmc_test_seq_perf(test, write, 100 * 1024 * 1024, 1); | ||
1932 | if (ret) | ||
1933 | return ret; | ||
1934 | } | ||
1935 | for (i = 0; i < 3; i++) { | ||
1936 | ret = mmc_test_seq_perf(test, write, 1000 * 1024 * 1024, 1); | ||
1937 | if (ret) | ||
1938 | return ret; | ||
1939 | } | ||
1940 | |||
1941 | return ret; | ||
1942 | } | ||
1943 | |||
1944 | /* | ||
1945 | * Large sequential read performance. | ||
1946 | */ | ||
1947 | static int mmc_test_large_seq_read_perf(struct mmc_test_card *test) | ||
1948 | { | ||
1949 | return mmc_test_large_seq_perf(test, 0); | ||
1950 | } | ||
1951 | |||
1952 | /* | ||
1953 | * Large sequential write performance. | ||
1954 | */ | ||
1955 | static int mmc_test_large_seq_write_perf(struct mmc_test_card *test) | ||
1956 | { | ||
1957 | return mmc_test_large_seq_perf(test, 1); | ||
1958 | } | ||
1959 | |||
1874 | static const struct mmc_test_case mmc_test_cases[] = { | 1960 | static const struct mmc_test_case mmc_test_cases[] = { |
1875 | { | 1961 | { |
1876 | .name = "Basic write (no data verification)", | 1962 | .name = "Basic write (no data verification)", |
@@ -2124,6 +2210,20 @@ static const struct mmc_test_case mmc_test_cases[] = { | |||
2124 | .cleanup = mmc_test_area_cleanup, | 2210 | .cleanup = mmc_test_area_cleanup, |
2125 | }, | 2211 | }, |
2126 | 2212 | ||
2213 | { | ||
2214 | .name = "Large sequential read into scattered pages", | ||
2215 | .prepare = mmc_test_area_prepare, | ||
2216 | .run = mmc_test_large_seq_read_perf, | ||
2217 | .cleanup = mmc_test_area_cleanup, | ||
2218 | }, | ||
2219 | |||
2220 | { | ||
2221 | .name = "Large sequential write from scattered pages", | ||
2222 | .prepare = mmc_test_area_prepare, | ||
2223 | .run = mmc_test_large_seq_write_perf, | ||
2224 | .cleanup = mmc_test_area_cleanup, | ||
2225 | }, | ||
2226 | |||
2127 | }; | 2227 | }; |
2128 | 2228 | ||
2129 | static DEFINE_MUTEX(mmc_test_lock); | 2229 | static DEFINE_MUTEX(mmc_test_lock); |