summaryrefslogtreecommitdiff
path: root/tests/gem_gtt_speed.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-13 15:05:34 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-13 15:05:34 +0100
commit397cd4acd1c7789482eadb5cf24e667a9684d1fa (patch)
tree1fbe2d25ff284cc8af6bbb4d2b2a825f2b22197d /tests/gem_gtt_speed.c
parentf256ada3b689c4ecedfd2a2978a01ab01f266aaa (diff)
gem_gtt_speed: Add a test that caches the mmapping across iterations
Repeat the memset streaming performance test on the same mapping so that we can factor out the overhead of establishing the GTT/CPU mmaps. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_gtt_speed.c')
-rw-r--r--tests/gem_gtt_speed.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index 824eca3e..f0fb901b 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -143,6 +143,15 @@ int main(int argc, char **argv)
gettimeofday(&end, NULL);
printf("Time to clear %dk through a CPU map: %7.3fµs\n",
size/1024, elapsed(&start, &end, loop));
+
+ gettimeofday(&start, NULL);
+ base = gem_mmap__cpu(fd, handle, size, PROT_READ | PROT_WRITE);
+ for (loop = 0; loop < 1000; loop++)
+ memset(base, 0, size);
+ munmap(base, size);
+ gettimeofday(&end, NULL);
+ printf("Time to clear %dk through a cached CPU map: %7.3fµs\n",
+ size/1024, elapsed(&start, &end, loop));
}
/* CPU pwrite */
@@ -221,6 +230,15 @@ int main(int argc, char **argv)
printf("Time to clear %dk through a GTT map: %7.3fµs\n",
size/1024, elapsed(&start, &end, loop));
+ gettimeofday(&start, NULL);{
+ uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+ for (loop = 0; loop < 1000; loop++)
+ memset(base, 0, size);
+ munmap(base, size);
+ } gettimeofday(&end, NULL);
+ printf("Time to clear %dk through a cached GTT map: %7.3fµs\n",
+ size/1024, elapsed(&start, &end, loop));
+
/* mmap read */
gettimeofday(&start, NULL);
for (loop = 0; loop < 1000; loop++) {