Difference between the methods CPU Times

Questions about YourKit .NET Profiler
Post Reply
petrucio
Posts: 3
Joined: Tue Mar 04, 2008 5:00 pm

Difference between the methods CPU Times

Post by petrucio »

Hi,

Could soumeone explain me why the methods CPU Times are allways different when succesive profilings are made for the same application on the same conditions?

I'm running on Windows Xp, and I tried both sampling and tracing profiling methods.

Thank you.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

Hello,

How big is the difference? Could you please provide the numbers.

Best regards,
Anton
petrucio
Posts: 3
Joined: Tue Mar 04, 2008 5:00 pm

Post by petrucio »

For exemple I'm obtaining (in the same conditions) for a method call:
1. 3710 ms
2. 3750 ms
3. 3650 ms
4. 3800 ms

You can see that I'm obtainig differences up to 3%.

Is this normal?
I was expecting CPU Times with differences between [-10 ms , +10 ms].
Thank you.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

I think 3% is normal, especially with sampling.

Any measuring provides results with stochastic inaccuracies.

What is the nature of profiled method call? Is it purely computational, or does it perform any I/O operations?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

P.S.: I think if the method ran for a longer period of time (e.g. 10 seconds instead), the difference would be smaller.
petrucio
Posts: 3
Joined: Tue Mar 04, 2008 5:00 pm

Post by petrucio »

Are the methods purely computational?
In order to answer:
All I want to measure is the execution time of an iterative optimization algorithm under different optimization scenarios.
There are small differences between these scenarios.
So I need a quite accurate execution times measurments.
I can tell you that after each iteration there is a routine the writes same data into a buffer and when the algorithm stops the buffer is written into an output file.
Do you think that this may cause differences between the profiled times?
If this represents the problem...could you suggest me how to use the profiler?
If I ignored these methods for being profiled could I obtain more accurate results?
Thank you!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

File output can be one of reasons of execution time fluctuations.

If need most accurate results, you can:

1. Artificially increase number of repetitions of your algorithm for purposes of profiling. E.g. wrap it with a 'for' cycle. The bigger execution time, the smaller share of stochastic fluctuations.

2. For a more precise measuring, use tracing. Although it may be requires to tune filter set to receive most adequate results.
Post Reply