summaryrefslogtreecommitdiff
path: root/tests/gem_pread.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gem_pread.c')
-rw-r--r--tests/gem_pread.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/tests/gem_pread.c b/tests/gem_pread.c
index 7c2f18f3..b5c0e95d 100644
--- a/tests/gem_pread.c
+++ b/tests/gem_pread.c
@@ -93,9 +93,10 @@ int main(int argc, char **argv)
{ -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;
@@ -106,41 +107,44 @@ int main(int argc, char **argv)
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();
}