I am unable to profile any application using Visual Studio profiler in Virtual Machines. I have used Virtual machines of Amazon EC2 at work and Virtualbox, Vmware at home. Also I have used AMD Codeanalyst profiler. But none of the combination works.
- Does anyone know why its not working?
- How can I make it work?
- Do you know any good profiler that works?
There are a couple of problems with profilers in VMs:
Time really can't be virtualized, so time stamps tell you less than you'd like. This is because virtual processors don't run continuously, and designers of virtual machine systems have to choose between time tracking external clocks (like the one on the wall) and time seeming to pass continuously within a VM. In order to make network protocols work, almost everybody chooses tracking external time. Profilers, however, are usually geared to the time spent on a task, which is the opposite choice.
In Windows, profiling is accomplished with a hardware clock that is mostly not in use during regular machine operation. (Specficially, the Local APIC Timer.) It wouldn't surprise me if those virtual machines didn't implement one because they'd never seen their customers actually turn it on. I use Hyper-V, which does implement it, so I can't comment on Virtual Box or VMWare.
http://blogs.msdn.com/b/mgoldin/archive/2010/01/09/visual-studio-profiler-in-virtual-environment.aspx
There is some information from the VS performance team here. It seems that Visual Studio 2010 has sampling based profiling support under Virtualization. What I'm observing though, is that it's code they have added to Visual Studio to deal with it and seems to work with VMWare, Hyper-V, and VPC. It does not seem to work under VirtualBox (confirmed today with 4.0)
I'm about to test the appliance I created with VirtualBox under VMWare Player and see if it works. The good news is that you can use Visual Studio 2010 sample based profiling against code built with 2008.