diff options
author | Pierrick Bouvier <pierrick.bouvier@linaro.org> | 2024-06-20 16:22:18 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-06-24 10:15:10 +0100 |
commit | 72db6d54a4a9203736261fc63f32f6cd3486b7e4 (patch) | |
tree | d549b30e42fcd6926436269d28c571a77e15aaa0 /fsdev/qemu-fsdev-throttle.h | |
parent | 508036532c5ee1c72896f6b950e8629cf334e485 (diff) |
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>
Diffstat (limited to 'fsdev/qemu-fsdev-throttle.h')
0 files changed, 0 insertions, 0 deletions