test/memcpy: test with a more consistent alignment

On some platforms, the page index affects the measurements.

genodelabs/genode#4454
This commit is contained in:
Johannes Schlatow 2022-03-25 14:09:24 +01:00 committed by Christian Helmuth
parent 07736d1689
commit 92bcc50c0a
2 changed files with 24 additions and 12 deletions

View File

@ -26,7 +26,7 @@ install_config {
<default caps="200"/>
<start name="test-memcpy">
<resource name="RAM" quantum="32M"/>
<resource name="RAM" quantum="40M"/>
<config>
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
<libc stdout="/dev/log" stderr="/dev/log" socket="/socket"/>
@ -51,19 +51,21 @@ proc run_test {name serial_id} {
}
run_genode_until "Memcpy testsuite started.*\n" 60
set serial_id [output_spawn_id]
set byte_dur [run_test "bytewise memcpy" $serial_id]
set genode_dur [run_test "Genode memcpy" $serial_id]
set genode_set_dur [run_test "Genode memset" $serial_id]
set libc_cpy_dur [run_test "libc memcpy" $serial_id]
set libc_set_dur [run_test "libc memset" $serial_id]
set uncached_wr_dur [run_test "Genode memcpy" $serial_id]
set uncached_rd_dur [run_test "Genode memcpy" $serial_id]
set serial_id [output_spawn_id]
set byte_dur [run_test "bytewise memcpy" $serial_id]
set genode_dur [run_test "Genode memcpy" $serial_id]
set genode_set_dur [run_test "Genode memset" $serial_id]
set libc_cpy_dur [run_test "libc memcpy" $serial_id]
set libc_set_dur [run_test "libc memset" $serial_id]
set genode_offset_dur [run_test "Genode memcpy" $serial_id]
set uncached_wr_dur [run_test "Genode memcpy" $serial_id]
set uncached_rd_dur [run_test "Genode memcpy" $serial_id]
puts "bytewise: copied 8 GB in $byte_dur milliseconds ([expr {8192000 / $byte_dur}] MiB/sec)"
puts "memcpy: copied 8 GB in $genode_dur milliseconds ([expr {8192000 / $genode_dur}] MiB/sec)"
puts "memset: copied 8 GB in $genode_set_dur milliseconds ([expr {8192000 / $genode_set_dur}] MiB/sec)"
puts "libc memcpy: copied 8 GB in $libc_cpy_dur milliseconds ([expr {8192000 / $libc_cpy_dur}] MiB/sec)"
puts "libc memset: copied 8 GB in $libc_set_dur milliseconds ([expr {8192000 / $libc_set_dur}] MiB/sec)"
puts "memcpy (page offset): copied 8 GB in $genode_offset_dur milliseconds ([expr {8192000 / $genode_offset_dur}] MiB/sec)"
puts "memcpy (uncached write): copied 8 GB in $uncached_wr_dur milliseconds ([expr {8192000 / $uncached_wr_dur}] MiB/sec)"
puts "memcpy (uncached read): copied 8 GB in $uncached_rd_dur milliseconds ([expr {8192000 / $uncached_rd_dur}] MiB/sec)"
exit 0

View File

@ -58,12 +58,22 @@ void Libc::Component::construct(Libc::Env &env)
{
log("Memcpy testsuite started");
memcpy_test<Bytewise_test>();
memcpy_test<Genode_cpy_test>();
/* Alloc dataspaces to control page alignment */
Genode::Attached_ram_dataspace cached_ds1(env.ram(), env.rm(),
BUF_SIZE, Genode::CACHED);
Genode::Attached_ram_dataspace cached_ds2(env.ram(), env.rm(),
BUF_SIZE+4096, Genode::CACHED);
memcpy_test<Bytewise_test> (cached_ds1.local_addr<void>(), cached_ds2.local_addr<void>(), BUF_SIZE);
memcpy_test<Genode_cpy_test>(cached_ds1.local_addr<void>(), cached_ds2.local_addr<void>(), BUF_SIZE);
memcpy_test<Genode_set_test>();
memcpy_test<Libc_cpy_test>();
memcpy_test<Libc_cpy_test> (cached_ds1.local_addr<void>(), cached_ds2.local_addr<void>(), BUF_SIZE);
memcpy_test<Libc_set_test>();
/* offset src by one page so that src and dst have different cache indices */
memcpy_test<Genode_cpy_test>( cached_ds1.local_addr<void>(),
(void*)((Genode::addr_t)cached_ds2.local_addr<void>()+4096), BUF_SIZE);
Genode::Attached_ram_dataspace uncached_ds(env.ram(), env.rm(),
BUF_SIZE, Genode::UNCACHED);