33

Does anyone know of a way to limit the CPU speed in a virtual machine? Or if there is even a virtualization software that allows you to do this?

I am trying to find the minimum requirements for a system, given a specific OS image that I have. I see ways to limit RAM and hard disk size and number of cores, but I need to slow the CPU down to 800 MHz in order to really simulate the system configuration. Also, the computer running the virtual machine is a Windows 7 machine.

RCC
  • 331

9 Answers9

24

I have been tasked with the same problem and I installed Oracle VirtualBox on Windows 7 (as host) and Ubuntu (as guest). I used a standalone laptop, HP EliteBook 8540W with Intl Core i7 running at 1.87 GigHZ and 8Gig RAM.

Assuming your installation works properly, on your Guest machine (e.g. in my case, Ubuntu) select "Settings..." from "Machine" in the main menu; select "System" and click on "Processor" tab. You can adjust the clock speed (labeled, "Execution Cap") by sliding the indicator on the bar all the way down to 1 percent.

I assumed that the host OS (Windows 7 in my case) was not consuming any clock cycles (I confirmed this by checking the "Task Manager" and I found ZERO CPU utilization on the host machine .i.e. windows 7 in my case). Therefore, I asuumed 100% "execution cap" equals that of host machine (e.g. 1.87 GigHZ). I think by taking a percentage between your host machine clock speed and 800 MHZ, you are able to figure out the percentage value that corresponds to 800 MHZ.

I hope this helps.

Best of luck.

Seif
  • 241
10

On VMWare ESX and ESXi you can create a Resource Pool and limit the CPU Resources for that pool. This would allow you limit the CPU speed of any systems created in that Resource Pool.

LeoB
  • 663
6

Compiled and used: cpulimit which worked like a charm to slow the VM down.

2

While I'm no expert on all the different virtualizations technologies, I think it's unlikely you'll find such a setting. However, you'll find settings (at least in MS hyper-V) that allow you to limit a virtual machine to a percent of the overall host machines actions. So if you have a 8 core host running at 2 GHz, you could try limiting the client virtual machine to one core, and no more than 45% of the core.

However, this would be very crude and not suitable if you're trying to test timing loops or something where the actual processor speed comes into play.

Knox
  • 1,188
2

--cpuexecutioncap <1-100>: This setting controls how much cpu time a virtual CPU can use. A value of 50 implies a single virtual CPU can use up to 50% of a single host CPU.

Oh Nah
  • 21
1

I can confirm that this is not supported in VirtualBox. However, the documentation seems to be iffy on whether or not VMware is able to do this.

EDIT: For VMware: "This is not possible with the Player and Server products, but I believe it is in the ESXi (the free "bare-metal hypervisor" product) and the paid-for products like VMWare Workstation."

nopcorn
  • 16,982
1

You might be able to simulate this with CPU pinning. Then create some CPU bound processes pinned to the same CPU. Estimated CPU speed is (Real CPU speed / # of processes).

Some resource limiting software will allow you to limit resource percentages. This would make it easier to limit CPU speed. To do so you need to disable access to spare resources.

BillThor
  • 11,345
  • 2
  • 28
  • 25
0

On VirtualBOX there is a slider where you can configure the % of host CPU that guest CPU can use. Such percent applies to each core.

On VirtualBOX there is no way to simulate a multi-core with diffrent speeds on each core, only one slider for all cores.

Setting the slider at 50% will make guest cores to run at 1/2 of host cores (a per core basics).

So if you have a deca core (10 cores) on host and a tri core on guest (three), and you want guest run at X MHz while host runs at Y MHz, just ignore the number of cores to calculate the percent.

The formula would be: Percent=100*X/Y

Hope this also helps other people comming here on the future.

Laura
  • 1
-1

You can also do this (windows only) by Registy Editor, hkey local machine ,hardware, descrpption, system, CentralProcessor, any number, then ProcessorNameString, wont save when you restart/shutdown