qemu/contrib
Pierrick Bouvier 72db6d54a4 contrib/plugins: add Instructions Per Second (IPS) example for cost modeling
This plugin uses the new time control interface to make decisions
about the state of time during the emulation. The algorithm is
currently very simple. The user specifies an ips rate which applies
per core. If the core runs ahead of its allocated execution time the
plugin sleeps for a bit to let real time catch up. Either way time is
updated for the emulation as a function of total executed instructions
with some adjustments for cores that idle.

Examples
--------

Slow down execution of /bin/true:
$ num_insn=$(./build/qemu-x86_64 -plugin ./build/tests/plugin/libinsn.so -d plugin /bin/true |& grep total | sed -e 's/.*: //')
$ time ./build/qemu-x86_64 -plugin ./build/contrib/plugins/libips.so,ips=$(($num_insn/4)) /bin/true
real 4.000s

Boot a Linux kernel simulating a 250MHz cpu:
$ /build/qemu-system-x86_64 -kernel /boot/vmlinuz-6.1.0-21-amd64 -append "console=ttyS0" -plugin ./build/contrib/plugins/libips.so,ips=$((250*1000*1000)) -smp 1 -m 512
check time until kernel panic on serial0

Tested in system mode by booting a full debian system, and using:
$ sysbench cpu run
Performance decrease linearly with the given number of ips.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240530220610.1245424-7-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240620152220.2192768-11-alex.bennee@linaro.org>
2024-06-24 10:15:10 +01:00
..
elf2dmp contrib/elf2dmp: Ensure phdrs fit in file 2024-03-11 17:06:27 +00:00
gitdm contrib/gitdm: add Daynix to domain-map 2023-11-08 15:15:23 +00:00
ivshmem-client configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00
ivshmem-server configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00
plugins contrib/plugins: add Instructions Per Second (IPS) example for cost modeling 2024-06-24 10:15:10 +01:00
systemd contrib: add systemd unit files 2017-12-20 22:29:26 +01:00
vhost-user-blk configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00
vhost-user-gpu virtio-gpu: Correct virgl_renderer_resource_get_info() error check 2024-02-14 06:09:33 -05:00
vhost-user-input configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00
vhost-user-scsi configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00