summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-13 14:55:53 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-13 14:59:09 +0100
commitf256ada3b689c4ecedfd2a2978a01ab01f266aaa (patch)
tree96983e4abb167ef859c31385bd28d1bec2b4f9a2
parentefd68f9d64caf7b359df2d7512f89d61c4b6e3ae (diff)
gem_gtt_speed: Use a memset() to test streaming performance
This make the reasonable assumption that the libc code for memset() can saturate the memory bandwidth -- at any rate it should do better than the copy. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_gtt_speed.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index 73a3c6dc..824eca3e 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -133,6 +133,16 @@ int main(int argc, char **argv)
gettimeofday(&end, NULL);
printf("Time to write %dk through a CPU map: %7.3fµs\n",
size/1024, elapsed(&start, &end, loop));
+
+ gettimeofday(&start, NULL);
+ for (loop = 0; loop < 1000; loop++) {
+ base = gem_mmap__cpu(fd, handle, size, PROT_READ | PROT_WRITE);
+ memset(base, 0, size);
+ munmap(base, size);
+ }
+ gettimeofday(&end, NULL);
+ printf("Time to clear %dk through a CPU map: %7.3fµs\n",
+ size/1024, elapsed(&start, &end, loop));
}
/* CPU pwrite */
@@ -200,6 +210,17 @@ int main(int argc, char **argv)
printf("Time to write %dk through a GTT map: %7.3fµs\n",
size/1024, elapsed(&start, &end, loop));
+ /* mmap clear */
+ gettimeofday(&start, NULL);
+ for (loop = 0; loop < 1000; loop++) {
+ uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+ memset(base, 0, size);
+ munmap(base, size);
+ }
+ gettimeofday(&end, NULL);
+ printf("Time to clear %dk through a GTT map: %7.3fµs\n",
+ size/1024, elapsed(&start, &end, loop));
+
/* mmap read */
gettimeofday(&start, NULL);
for (loop = 0; loop < 1000; loop++) {