Yesterday I checked out the various ways in Visual Studio 2005 to do perfomance profiling of apps. In the past I was using CLR Profiler and really like it a lot - so I was a bit biased when looking at VS 2005.
Essentially there are two approaches to profiling in VS 2005: sampling and instrumentation. Let's look briefly at both (from the MSDN docs):
- Sampling
Sampling, in which the application is periodically interrupted, provides the advantage of low overhead, which allows the application to behave closer to how it would behave in the real world. During sampling, the performance data collection infrastructure periodically interrupts the application as it runs to determine what function is running and increments the sample count of that function. It stores information about the call stack leading up to the function call. The drawback to this approach is that it can get only relative performance data for the functions that were sampled. It is possible that a function you wanted to sample did not get sampled and therefore, no information is available about it.
Note. You must choose appropriate sampling event to be used during sampling. For example, CPU cycle sample event only shows the locations in the application that consume CPU cycles. If the application is blocked waiting for disk, network, page fault, etc. the resulting information will not be helpful in determining the actual problem. To detect problems with page faults, use page fault as the sample event.
- Instrumentation
Instrumentation provides the advantage of gathering exact performance data for specific sections of the application. During instrumentation, enter and exit probes are inserted into the application's functions. These probes report back to the data collection infrastructure and allow users to capture exact amounts of time and other metrics that a function took to run.
Note: Probes are not inserted in inline functions - functions compiled with /Ox (Full Optimization). Therefore, number of calls in the report will not agree with the actual number of times the code block executed. To determine the exact number of times that code block executed, compile code with /Ob0. However, compiling code using this option will impact code optimization.
OK, what I wanted to test is sampling with a very simple sample Windows Forms application. So I fired up my Virtual PC image and configured the perfomance tools inside of VS 2005.
Finally I ran the profiling.... dang!!!
What happened?
It turns out that the profiling tools installs a device driver to help out with exact timing. The driver tries to set interrupts and catches them - those interrupts are not supported in the current Virtual PC version. Aha!
So hopefully the teams at Microsoft will be working together to figure out how to deal with that problem.
Hm... but honestly: if you really want and need performance measuring then VPC is not your first calss choice. Maybe only if you really want to deploy your software through VPC images.
Profilers tend to read low-level processor performance counters, using things like the x86 RDTSC instruction. There are a couple of hundred such counters on recent P4s: dig into the VTune documentation, for example. It would be very difficult for virtual machines to provide an accurate representation of those counters, since the VM would have to subtract out its own overhead, and this in itself would exact a performance overhead. My guess is that profiler and VM writers decide that it's not worth fixing.
Posted by: George V. Reilly | 01/19/2006 at 03:35 AM
You look like a helpful lot . Thanks by the way.
Posted by: Cheap Computers Canada | 04/01/2010 at 11:25 AM
They won't help you when you're down
Love's on your list of things to do
To bring your good luck back to you
And if you think that everything's unfair
Would you care if you're the last one standing there
Posted by: coach handbags | 07/19/2010 at 03:21 AM
It is a pleasure for me to say hello, I hope my comment is to welcome to all who read it sometime. To begin I would like to congratulate the person in charge of this blog, I think he spent much time and dedication, secondly I would stress the importance of reading, I believe that today's young people read less and less each passing day forget how important it can be learned through reading.
Posted by: Impotence causes | 11/10/2010 at 06:25 PM
good job guys
Posted by: buy from taobao | 11/11/2010 at 01:25 PM
Amazing! I'm really surprised, I did not expect much I liked this article, I read it because a friend recommended it to me, I assure you that when he told me to read not think it was so interesting. I congratulate the creators for the excellent job they did, I will continue to recommend to my friends this article is great!
Posted by: Cheap viagra | 11/12/2010 at 07:50 PM
I've been reading your post and I think have very good information, I would like to know the methodology you use to write your post.
Posted by: Inversiones en oro | 04/12/2011 at 05:28 PM