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>
This commit is contained in:
Chris Wilson 2012-09-13 15:05:34 +01:00
parent f256ada3b6
commit 397cd4acd1

View File

@ -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++) {