Incorrect time results from on Vista


I've downloaded the latest ants profiler from your web site and I encounter strange time results.

My sample function which doesn't do anything apart from utilizing CPU should last at least 10 seconds:

class Program
static void Main(string[] args)
Stopwatch sw = new Stopwatch();
while (sw.Elapsed < TimeSpan.FromSeconds(10)) { }

Profiler shows me various times, between 5 and 8 seconds.

I'm using Visual Studio 2008 Team Suite (Trial), the project is .NET 2.0 console application. I'm using Vista x64. but I tested my project with x86 and x64 configuration.

Am I doing something wrong or this is a bug?


  • Hi,

    This is actually what we'd expect you to see. ANTS Profiler necessarily introduces some overhead as a result of profiling your application, and as a result, we subtract our best guess at this overhead from the times we display in the results.

    This generally means you get results closer to those you'd see when the application was running outside the profiler. However, in your example, your stopwatch measure ten seconds including the time spent in the profiler - so in other words, the profiler is running for 2-5 seconds, and your application code is running for the 5-8 seconds you see in the results.

    The exact overhead of the profiler varies, but very tight loops like you have there tend to be just about the worst case for it.

    If you try profiling in fast mode, you'll probably see that the method as a whole does get reported as 10 seconds, or at least much closer to it.

    Hope that helps,
    Robert Chipperfield
    Red Gate
  • Hi Robert,

    Thanks for an explenation, I get it now.

    Lukasz Podolak
Sign In or Register to comment.