<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">16 Мар 2017 г. 13:18 пользователь "Daniel P. Berrange" <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> написал:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Thu, Mar 16, 2017 at 12:14:31AM +0300, Vasiliy Tolstov wrote:<br>
</div><div class="quoted-text">> Hi. Does it possible to limit vm cpu speed for example to 1Ghz or 500Mhz ?<br>
> I need to simulate some hardware with specific cpu speed and test my<br>
> application inside this vm , i want to measure results from each test<br>
> and need constant cpu speed for testing (i need to run test not only<br>
> my notebook but on server too and want identical cpu speed inside vm)<br>
<br>
</div>There's no way to do this at a KVM or libvirt level. The host kernel will<br>
always auto-scale CPU frequency according to the load placed on them by<br>
the guest OS (and other processes).<br>
<br>
To get a fixed frequency,and predictable benchmark results you would<br>
have to first use CPUAffinity in systemd.conf (or equiv) to ensure<br>
no other OS processes run on a particular chosen CPU. Then strictly<br>
bind the guest vCPU to that host CPU. Finally you would have to<br>
use sysfs to set the scaling_max_freq/min_freq to contrl what speed<br>
your host CPUs ran at.<br>
<br><br><br><br>
Regards,<br>
Daniel<br>
<font color="#888888">--<br>
|: <a href="http://berrange.com" rel="noreferrer" target="_blank">http://berrange.com</a>      -o-    <a href="http://www.flickr.com/photos/dberrange/" rel="noreferrer" target="_blank">http://www.flickr.com/photos/<wbr>dberrange/</a> :|<br>
|: <a href="http://libvirt.org" rel="noreferrer" target="_blank">http://libvirt.org</a>              -o-             <a href="http://virt-manager.org" rel="noreferrer" target="_blank">http://virt-manager.org</a> :|<br>
|: <a href="http://entangle-photo.org" rel="noreferrer" target="_blank">http://entangle-photo.org</a>       -o-    <a href="http://search.cpan.org/~danberr/" rel="noreferrer" target="_blank">http://search.cpan.org/~<wbr>danberr/</a> :|<br>
</font></blockquote></div><br></div></div><div class="gmail_extra" dir="auto"><br></div><div class="gmail_extra" dir="auto">Thanks! Next question, does it possible to provide constant speed for vps in case of cloud service? For example user buy vps with 500mhz or 1ghz and pay for guaranteed resource?</div><div class="gmail_extra" dir="auto">Weights not very useful because I can't guarantee that each vps have needed processor time...</div></div>