Reputation: 11763
It is the first time for me to use Microsoft Visual Studio 2010 Performance Profiler for profiling. After the application program is finished, I use CPU Sampling method for profiling and create a performance section. After that I launch profiling. The problem I have found is that each time I profiles the same program I get different samples accounts. The following picture can illustrate my problem:
In the above picture the
baseline file
and comparison file
come from the same application program. I expect that these two profile files should be the same, but in reality they are not. I was wondering what I could do in order to obtain consistent result. Thanks!
Upvotes: 0
Views: 275
Reputation: 942177
That's just not possible when you use the sampling method to profile your program. It works by periodically interrupting your program and finding out what it is doing. Inevitably, the odds that it will reliably interrupt your program at the exact same place when you profile repeatedly are very low. The data you'll get is only statistically relevant, it is an estimate and useful to find hotspots in your code. Which is something you should always be checking first when you profile.
You'll need the instrumentation method to get hard numbers about the number of times a function executes. The profiler now reliably records when a function is entered. Biggest problem with that is that it drastically slows down your program.
Background info on these profiling methods is available in this MSDN Library article.
Upvotes: 1