Line-level timings problem?

Hi everyone,
I started using the performance profiler a couple of months ago, thus I'm probably not so skilled in it.

I'm profiling a part of my .Net 4 application, precisely the one that has to make a lot of math computation. To simplify, suppose we a have a "for" statement looping a lot (about 500 thousands) of times. Within the statement there's the code the makes the actual computation on some signals samples.

The problem is that each time I profile my code (using always the same set of input data) I have different timing information, even the one that refers to the "for" first row (I mean: for (int i = 0; ... ) ).
Since I'm using "Line-level and method-level timings; all methods" profiling mode, I thought the timing values were "pure" execution times (I mean, they don't depend on what else my pc is running).

I'm using ANTS Performance Profiler 7.3 Professional.

Thanks a lot for,
have a nice day
Marco Stevanato

Software Engineer
Aprilia Racing S.r.l.


  • James BJames B Posts: 1,124 Silver 4
    Thanks for your post.

    The line-level timing is actually the most *detailed* but not the most *accurate*. The profiler tries to adjust timings to counteract the effect profiling has on the performance of the application and this is actually less reliable on line-level timing. This could easily mean you get slightly different results each time you run.

    We explain the various modes on this page and you'll see that method level (only with source) is the most 'accurate'
    Systems Software Engineer

    Redgate Software

  • Thanks a lot for your answer, I'll take a look at the link you gave me.

    Have a nice day
    Marco Stevanato

    Software Engineer
    Aprilia Racing S.r.l.
Sign In or Register to comment.