summaryrefslogtreecommitdiff
path: root/tests/gem_pwrite_pread.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-07 11:59:05 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-07 11:59:05 +0200
commit57622965e57a9d9dfb491434169bce1ea3aa94fe (patch)
treeda129fbd33df59d0f53de06e807c365117b6c626 /tests/gem_pwrite_pread.c
parent3dba47e8962ec6ebf7e8825531bd46ab54a84ec6 (diff)
tests/gem_pwrite_pread: subtest annotation
This testcase mixes correctnes tests with performance tests, so it's good to track the different correctness test separate for QA. Together with pread_after_blt the pwrite->blt tests here exercise the full cache coherency lifecycle of both snooped and uncached objects. /me is happy Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/gem_pwrite_pread.c')
-rw-r--r--tests/gem_pwrite_pread.c109
1 files changed, 61 insertions, 48 deletions
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index 9f7c227a..09a1f005 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -383,6 +383,7 @@ int main(int argc, char **argv)
uint32_t *tmp, src, dst;
int fd, count;
+ drmtest_subtest_init(argc, argv);
drmtest_skip_on_simulation();
if (argc > 1)
@@ -399,62 +400,74 @@ int main(int argc, char **argv)
gem_set_cacheing(fd, src, 0);
gem_set_cacheing(fd, dst, 0);
- test_copy(fd, src, dst, tmp, object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- copy(fd, src, dst, tmp, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to uncached copy %d bytes x %6d: %7.3fµs, %s\n",
- object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
- fflush(stdout);
+ if (drmtest_run_subtest("uncached-copy-correctness"))
+ test_copy(fd, src, dst, tmp, object_size);
+ if (drmtest_run_subtest("uncached-copy-performance")) {
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ copy(fd, src, dst, tmp, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to uncached copy %d bytes x %6d: %7.3fµs, %s\n",
+ object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
- test_as_gtt_mmap(fd, src, dst, object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- as_gtt_mmap(fd, src, dst, tmp, object_size, count);
- gettimeofday(&end, NULL);
- printf("** mmap uncached copy %d bytes x %6d: %7.3fµs, %s\n",
- object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
- fflush(stdout);
+ if (drmtest_run_subtest("uncached-pwrite-blt-gtt_mmap-correctness"))
+ test_as_gtt_mmap(fd, src, dst, object_size);
+ if (drmtest_run_subtest("uncached-pwrite-blt-gtt_mmap-performance")) {
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ as_gtt_mmap(fd, src, dst, tmp, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("** mmap uncached copy %d bytes x %6d: %7.3fµs, %s\n",
+ object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
gem_set_cacheing(fd, src, 1);
gem_set_cacheing(fd, dst, 1);
- test_copy(fd, src, dst, tmp, object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- copy(fd, src, dst, tmp, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to snooped copy %d bytes x %6d: %7.3fµs, %s\n",
- object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
- fflush(stdout);
+ if (drmtest_run_subtest("snooped-copy-correctness"))
+ test_copy(fd, src, dst, tmp, object_size);
+ if (drmtest_run_subtest("snooped-copy-performance")) {
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ copy(fd, src, dst, tmp, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to snooped copy %d bytes x %6d: %7.3fµs, %s\n",
+ object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
- test_as_cpu_mmap(fd, src, dst, object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- as_cpu_mmap(fd, src, dst, tmp, object_size, count);
- gettimeofday(&end, NULL);
- printf("** mmap snooped copy %d bytes x %6d: %7.3fµs, %s\n",
- object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
- fflush(stdout);
+ if (drmtest_run_subtest("snooped-pwrite-blt-cpu_mmap-correctness"))
+ test_as_cpu_mmap(fd, src, dst, object_size);
+ if (drmtest_run_subtest("snooped-pwrite-blt-cpu_mmap-performance")) {
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ as_cpu_mmap(fd, src, dst, tmp, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("** mmap snooped copy %d bytes x %6d: %7.3fµs, %s\n",
+ object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
free(tmp);