3

I'm trying to check on CPU steal times in a virtual machine. The goal is for me to be able to detect if my app is running in a VM on over-committed hardware.

I'm currently just testing, in preparation for later production.

I was trying to test this on Ubuntu 11.04, running on Virtual Box 4.1.4 on Max OS 10.6.8.

When I run the vmstat command, the man page leads me to believe I should see an "st" column under the CPU section. I don't see this. I just get "us sy id wa".

I can do a "vmstat -s", and I get " 0 stolen cpu ticks". I get 0, even when I load up the host machine to the point that virtual box is getting only 20% of the CPU (and VB is running multiple CPU sucking loops).

I'm getting the impression that vmstat is not detecting stolen CPU cycles in Ubuntu.

Is there something else I should be doing? Or is my basic understanding wrong?

Is there a better way to detect that I'm being starved for CPU time in a VM?

  • 1
    VirtualBox doesn't provide CPU steal time data. Try again with a different hypervisor, preferably the one that will actually be used in production. – Michael Hampton Nov 28 '15 at 09:40

1 Answers1

1

If you run top you should see a line for Cpu(s): . At the end of the CPU line is ‘%st’. That stands for 'Steal Time'. Steal time is the time that the CPU was running something, but the hypervisor is running something else instead.

If you don't see %st in top or ‘Stolen CPU ticks’ in ‘vmstat -s’, then I would try and upgrade your installation of procps.

Thomas Vincent
  • 1,090
  • 6
  • 13