{ -1 },
}, *c;
+ drmtest_subtest_init(argc, argv);
drmtest_skip_on_simulation();
- if (argc > 1)
+ if (argc > 1 && atoi(argv[1]))
object_size = atoi(argv[1]);
if (object_size == 0)
object_size = OBJECT_SIZE;
dst = gem_create(fd, object_size);
src = malloc(object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- do_gem_read(fd, dst, src, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to pread %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);
- }
-
- for (c = cache; c->level != -1; c++) {
- if (gem_set_caching(fd, dst, c->level))
- continue;
-
+ drmtest_subtest_block("normal") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
gettimeofday(&start, NULL);
do_gem_read(fd, dst, src, object_size, count);
gettimeofday(&end, NULL);
- printf("Time to %s pread %d bytes x %6d: %7.3fµs, %s\n",
- c->name, object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ printf("Time to pread %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);
}
}
+ for (c = cache; c->level != -1; c++) {
+ drmtest_subtest_block(c->name) {
+ gem_set_caching(fd, dst, c->level);
+
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ do_gem_read(fd, dst, src, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to %s pread %d bytes x %6d: %7.3fµs, %s\n",
+ c->name, object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
+ }
+ }
+
free(src);
gem_close(fd, dst);
close(fd);
- return 0;
+ return drmtest_retval();
}
drmtest_skip_on_simulation();
- if (argc > 1)
+ drmtest_subtest_init(argc, argv);
+ drmtest_skip_on_simulation();
+
+ if (argc > 1 && atoi(argv[1]))
object_size = atoi(argv[1]);
if (object_size == 0)
object_size = OBJECT_SIZE;
dst = gem_create(fd, object_size);
src = malloc(object_size);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- do_gem_write(fd, dst, src, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to pwrite %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);
- }
-
- for (c = cache; c->level != -1; c++) {
- if (gem_set_caching(fd, dst, c->level))
- continue;
-
+ drmtest_subtest_block("normal") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
gettimeofday(&start, NULL);
do_gem_write(fd, dst, src, object_size, count);
gettimeofday(&end, NULL);
- printf("Time to %s pwrite %d bytes x %6d: %7.3fµs, %s\n",
- c->name, object_size, count,
+ printf("Time to pwrite %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);
}
}
+ for (c = cache; c->level != -1; c++) {
+ drmtest_subtest_block(c->name) {
+ gem_set_caching(fd, dst, c->level);
+
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ do_gem_write(fd, dst, src, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to %s pwrite %d bytes x %6d: %7.3fµs, %s\n",
+ c->name, object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
+ }
+ }
+
free(src);
gem_close(fd, dst);
close(fd);
- return 0;
+ return drmtest_retval();
}
src = gem_create(fd, object_size);
tmp = malloc(object_size);
- if (gem_set_caching(fd, src, 0) == 0 &&
- gem_set_caching(fd, dst, 0) == 0) {
- drmtest_subtest_block("uncached-copy-correctness")
- test_copy(fd, src, dst, tmp, object_size);
- drmtest_subtest_block("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);
- }
+ gem_set_caching(fd, src, 0);
+ gem_set_caching(fd, dst, 0);
+
+ drmtest_subtest_block("uncached-copy-correctness")
+ test_copy(fd, src, dst, tmp, object_size);
+ drmtest_subtest_block("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);
}
+ }
- drmtest_subtest_block("uncached-pwrite-blt-gtt_mmap-correctness")
- test_as_gtt_mmap(fd, src, dst, object_size);
- drmtest_subtest_block("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);
- }
+ drmtest_subtest_block("uncached-pwrite-blt-gtt_mmap-correctness")
+ test_as_gtt_mmap(fd, src, dst, object_size);
+ drmtest_subtest_block("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);
}
}
- if (gem_set_caching(fd, src, 1) == 0 &&
- gem_set_caching(fd, dst, 1) == 0) {
- drmtest_subtest_block("snooped-copy-correctness")
- test_copy(fd, src, dst, tmp, object_size);
- drmtest_subtest_block("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);
- }
+ gem_set_caching(fd, src, 1);
+ gem_set_caching(fd, dst, 1);
+
+ drmtest_subtest_block("snooped-copy-correctness")
+ test_copy(fd, src, dst, tmp, object_size);
+ drmtest_subtest_block("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);
}
+ }
- drmtest_subtest_block("snooped-pwrite-blt-cpu_mmap-correctness")
- test_as_cpu_mmap(fd, src, dst, object_size);
- drmtest_subtest_block("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);
- }
+ drmtest_subtest_block("snooped-pwrite-blt-cpu_mmap-correctness")
+ test_as_cpu_mmap(fd, src, dst, object_size);
+ drmtest_subtest_block("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);
}
}
- if (gem_set_caching(fd, src, 2) == 0 &&
- gem_set_caching(fd, dst, 2) == 0) {
- drmtest_subtest_block("display-copy-correctness")
- test_copy(fd, src, dst, tmp, object_size);
- drmtest_subtest_block("display-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 display 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_caching(fd, src, 2);
+ gem_set_caching(fd, dst, 2);
+
+ drmtest_subtest_block("display-copy-correctness")
+ test_copy(fd, src, dst, tmp, object_size);
+ drmtest_subtest_block("display-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 display 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);
}
+ }
- drmtest_subtest_block("display-pwrite-blt-gtt_mmap-correctness")
- test_as_gtt_mmap(fd, src, dst, object_size);
- drmtest_subtest_block("display-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 display 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);
- }
+ drmtest_subtest_block("display-pwrite-blt-gtt_mmap-correctness")
+ test_as_gtt_mmap(fd, src, dst, object_size);
+ drmtest_subtest_block("display-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 display 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);
}
}
close(fd);
- return 0;
+ return drmtest_retval();
}