Excessive CPU usage when using VBoxManage guestcontrol exec

Discussions related to using the OSE version of VirtualBox.

Excessive CPU usage when using VBoxManage guestcontrol exec

Postby jchatham » 2. Oct 2014, 19:37

I'm trying to track down the cause of some high processor usage in a couple of different virtualbox processes, and I see that there's an option to build virtualbox with "--build-profile", which supposedly enables profiling support... but I can't seem to find any further instructions on what to do next / how to actually get profiling information out of a running vbox process.

Can anyone point me in the direction of some answers?
Last edited by jchatham on 7. Oct 2014, 02:34, edited 1 time in total.
jchatham
 
Posts: 19
Joined: 15. Jul 2013, 20:57

Re: How do I use the build-profile option?

Postby noteirak » 2. Oct 2014, 23:39

Moved to Virtualbox OSE
Hyperbox - Virtual Infrastructure Manager - https://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Re: How do I use the build-profile option?

Postby Perryg » 3. Oct 2014, 03:53

You might want to ask this on the DEVs mailing list or IRC

https://www.virtualbox.org/wiki/Community
Perryg
Site Moderator
 
Posts: 34373
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How do I use the build-profile option?

Postby mhanor » 4. Oct 2014, 15:49

All you need is to look at the source code. The profile build seems to enable some extra statistics, that can be viewed in the VboxDbg Statistics window (run the VM with --debug) or by running VBoxManage debugvm vmname statistics
mhanor
Volunteer
 
Posts: 317
Joined: 7. Oct 2009, 12:40
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: various

Excessive CPU usage when using VBoxManage guestcontrol exec

Postby jchatham » 7. Oct 2014, 02:34

So, for reference, the profile build also adds enough extra information into the code to allow linux utilities like perf to do their thing, which is (so far) seeming much more useful than any extra statistics.

And, now that I've verified this particular problem isn't a result of my own tinkering with virtualbox code, here's the situation I'm trying to fix:

If you run a VBoxManage guestcontrol exec command with the --wait-stdout or the --wait-stderr flag, then - even if the process you're executing isn't actually generating any output - the virtual machine will start using significantly increased CPU, jumping up from an idle value of typically 2-4% of one CPU core, up to 30-110% of one CPU core - even though the guest still shows itself as being 99% idle in both cases.

I have so far tested this with:
Virtualbox versions ranging from 4.3.8 through 4.3.16
Both Virtualbox (gui) and VBoxHeadless - these are the processes that show the increased CPU load, not the VBoxManage call!
Linux host (Ubuntu 12.04) and Windows host (Win7)
Windows guests (XP, Win7, Server 2003, Server 2008)

All of these configurations demonstrate this issue, though some more than others (a Win7 host running a Win7 guest was the worst offender, eating 110% CPU just to run ping through VBoxManage, while WinXP on a linux host "only" spiked up to about 30% CPU.)
jchatham
 
Posts: 19
Joined: 15. Jul 2013, 20:57

Re: Excessive CPU usage when using VBoxManage guestcontrol e

Postby jchatham » 7. Oct 2014, 20:58

So, I've figured this one out - the end problem here is that the windows guest additions don't support waiting for output, which results in the VBoxManage program polling in a busy loop. The immediate solution is to add some delays into the loop in handleCtrlProcessExec in VBoxManageGuestCtrl.cpp; longer term, I'm going to have to see if I can implement waiting for output in windows guest additions.
jchatham
 
Posts: 19
Joined: 15. Jul 2013, 20:57


Return to VirtualBox OSE

Who is online

Users browsing this forum: No registered users and 2 guests