On Thu, Mar 16, 2017 at 12:14:31AM +0300, Vasiliy Tolstov wrote:
Hi. Does it possible to limit vm cpu speed for example to 1Ghz or
500Mhz ?
I need to simulate some hardware with specific cpu speed and test my
application inside this vm , i want to measure results from each test
and need constant cpu speed for testing (i need to run test not only
my notebook but on server too and want identical cpu speed inside vm)
There's no way to do this at a KVM or libvirt level. The host kernel will
always auto-scale CPU frequency according to the load placed on them by
the guest OS (and other processes).
To get a fixed frequency,and predictable benchmark results you would
have to first use CPUAffinity in systemd.conf (or equiv) to ensure
no other OS processes run on a particular chosen CPU. Then strictly
bind the guest vCPU to that host CPU. Finally you would have to
use sysfs to set the scaling_max_freq/min_freq to contrl what speed
your host CPUs ran at.
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://entangle-photo.org -o-
http://search.cpan.org/~danberr/ :|