summaryrefslogtreecommitdiff
path: root/tests/gem_pwrite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-06 15:12:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-06 16:58:59 +0100
commitaad68d1a86a515c96e7af02c7d048680b5e83071 (patch)
tree81e0389f39cd1e88e49f8a24f37ffe62b2feb238 /tests/gem_pwrite.c
parenta661c098b0156a7cba4f29af0d6f223ca72560ba (diff)
gem_pwrite: Time pwrites to both uncached/snooped memory
Diffstat (limited to 'tests/gem_pwrite.c')
-rw-r--r--tests/gem_pwrite.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index 45a7e63f..9c30dbbe 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -103,18 +103,35 @@ int main(int argc, char **argv)
dst = gem_create(fd, object_size);
src = malloc(object_size);
+
+ gem_set_cacheing(fd, dst, 0);
+ 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 uncached 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);
+ }
+
+ gem_set_cacheing(fd, dst, 1);
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",
+ printf("Time to snooped 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);
}
+
free(src);
gem_close(fd, dst);