genode/repos/libports/run/memcpy.run
2018-11-16 14:37:18 +01:00

79 lines
2.7 KiB
Plaintext

if { [get_cmd_switch --autopilot] } {
if {[have_include "power_on/qemu"]} {
puts "\nRun script does not support Qemu.\n"
exit 0
}
}
build "core init test/memcpy"
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route> <any-service> <parent/> </any-service> </default-route>
<default caps="200"/>
<start name="test-memcpy">
<resource name="RAM" quantum="32M"/>
<config>
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
<libc stdout="/dev/log" stderr="/dev/log" socket="/socket"/>
</config>
</start>
</config>
}
build_boot_image {
core init test-memcpy
ld.lib.so libc.lib.so vfs.lib.so
}
append qemu_args " -nographic "
proc run_test {name serial_id} {
run_genode_until "start $name.*\n" 20 $serial_id
set t1 [clock milliseconds]
run_genode_until "finished $name.*\n" 300 $serial_id
set t2 [clock milliseconds]
return [expr {$t2 - $t1}]
}
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]
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 (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
#
# 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)