mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
test/memcpy: fix optimistic results on Linux
When executed on Linux, the test was impaired by the copy-on-write optimisation since the source buffer was never initialised. By default, Linux only maps a zeroed page until the first write access to the page occurs. Since the source buffer was never written, the corresponding page was always present in the physically-indexed data cache. In consequence, the test merely measured write performance (similar to memset). genodelabs/genode#4454
This commit is contained in:
parent
62f37c5b1b
commit
07736d1689
@ -72,7 +72,14 @@ exit 0
|
||||
# Linux baseline measurements
|
||||
#
|
||||
|
||||
# Raspberry Pi 1
|
||||
# bytewise memcpy: copied 8388608 KiB in 93390210 usecs (87 MiB/sec)
|
||||
# libc memcpy: copied 8388608 KiB in 6238602 usecs (1313 MiB/sec)
|
||||
# libc memset: copied 8388608 KiB in 6023324 usecs (1360 MiB/sec)
|
||||
# Zynq-7000 @ 666MHz (L2 prefetching enabled, offset=0)
|
||||
# Genode memcpy: copied 8388608 KiB in 27362177 usecs (299 MiB/sec)
|
||||
# bytewise memcpy: copied 8388608 KiB in 43882888 usecs (186 MiB/sec)
|
||||
# libc memcpy: copied 8388608 KiB in 28702066 usecs (285 MiB/sec)
|
||||
# libc memset: copied 8388608 KiB in 4033019 usecs (2031 MiB/sec)
|
||||
|
||||
# Zynq-7000 @ 666MHz (L2 prefetching enabled, offset=4)
|
||||
# Genode memcpy: copied 8388608 KiB in 14985454 usecs (546 MiB/sec)
|
||||
# bytewise memcpy: copied 8388608 KiB in 39478781 usecs (207 MiB/sec)
|
||||
# libc memcpy: copied 8388608 KiB in 28792091 usecs (284 MiB/sec)
|
||||
# libc memset: copied 8388608 KiB in 4041102 usecs (2027 MiB/sec)
|
||||
|
@ -16,11 +16,19 @@ void memcpy_test(void * dst = nullptr, void * src = nullptr,
|
||||
void * const from_buf = src ? src : malloc(size);
|
||||
void * const to_buf = dst ? dst : malloc(size);
|
||||
|
||||
/**
|
||||
* initialising the buffer (with any value) is necessary to
|
||||
* a) circumvent copy-on-write optimisation on linux and
|
||||
* b) all pages are already allocated and mapped
|
||||
*/
|
||||
memset(from_buf, 0, size);
|
||||
memset(to_buf, 0, size);
|
||||
|
||||
Test test;
|
||||
test.start();
|
||||
|
||||
for (unsigned i = 0; i < ITERATION; i++)
|
||||
test.copy(to_buf, from_buf, BUF_SIZE);
|
||||
test.copy(to_buf, from_buf, size);
|
||||
|
||||
test.finished();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user