2

I'm using the top command in Linux to keep a close eye on Virtualbox which is running a VM.

The current CPU in the server is a Quad Core Xeon processor 3.3 Ghz and I have only assigned one core to the VM.

My question is, if top is reporting that the Virtualbox process is consuming 30 percent of the CPU is this for the single core I have assigned the VM or for all 4 cores?

If VB is consuming 30 percent of the entire CPU I think I may need to assign more cores to VB. Clients are reporting that their client machines freeze constantly when accessing the DB.

terdon
  • 54,564
Scandalist
  • 3,119

2 Answers2

2

If you have access to the host system, VBoxManage metrics is easy to use:

vboxmanage metrics setup --period 1 --samples 1 "*" "*CPU/*"

to configure which metrics will be captured and for which system/VM.

Then:

vboxmanage metrics collect "*" "*CPU/*:avg"

will show you the aggregates of processor usage on the host and by each running VM.

Note that in order to see Guest/* stats you might need to have installed Guest Additions on each VM.

Simón
  • 123
  • 7
0

By default, top reports the percentage use as a percentage of a single CPU. This has nothing to do with your VirtualBox settings, it is how top works and it is the same for all programs. That's why you often see >100% CPU usage in top. Have a look at my answer here for more details.

You can have top display CPU% as a percentage of total CPU power (all cores) by hitting I (that's capital I) while top is running.


EDIT to answer your comments:

  1. So if all 4 cores max out I would see cpu usage rocket to 400 percent?

    Yes, exactly.

  2. And if I'm seeing a total of 30 percent usage amongst all processes does that mean only 30 percent of a single core?

    Again, yes, exactly. Well, almost exactly. It is not 30% of a single core because different processes can be running on different cores. If you see a total of 30% usage, this means that the total processing power being used is the equivalent of 30% of a single core. This might mean that you have one core at 10%, two at 5% and one at 20%.

  3. And I also guess that this wouldn't actually reflect the CPU usage of the VM running under VB?

    Not sure what you mean here. The % usage of VirtualBox in top is how much of a single core is VBox using at that moment. This has nothing to do with how much of the virtual machine's virtual CPU is being used. To see that, you will need to use software running on the guest OS.

terdon
  • 54,564