ANTS 2.0 Hitcount/timing results appear incorrect

ANTS Profiler 2.0.0 BUILD 368

Simple code:
namespace AntsTest
{
  class Class1
  {
    static void Main()
    {
      Foo();
      for(int i= 0; i<1000; ++i)
      {
        Bar();
      }
    }

    static void Foo()
    { 
      Bar();
    }

    static void Bar()
    { System.Threading.Thread.Sleep(10); }
  }
}

After profiling, the Hierarchy view reports the following :
Main
Bar - Time=15.65 Hit=1001 Time w/ children=15.65
Foo - Time=0.00 Hit=1 Time w/ children=0.128

Foo
Bar - Time=15.65 Hit=1001 Time w/ children=15.65

These results look misleading as they are the total hitcount for all calls to a method, not the context hitcount within the hierarchy.

The Source code view displays the correct context values:
Main
Bar - Hit=1000 Time=15.6
Foo - Hit=1 Time=0.128

Foo
Bar - Hit=1 Time=0.128


Having the total values in the Hierarchy view makes it difficult and tedious to profile a callstack of methods, as the values displayed in this view do not help with that task.

Is there a way to get the values that are displayed in the Source code view also displayed in the hierarch view?

Second, the hitcount for Bar is incorrect in the Source code view. The function is clearly called 1001 times. The Source code view reports 2002 hits.
James Hebben

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi James,

    Thanks for the information. I get pretty much the same result when I run your code on my computer. The funny thing is, if I change the Bar() method so that it's empty, the results look okay: the FOR loop runs 1001 times and Bar() runs 1001 times as well.

    It looks like you've discovered a bug here. I'll pass this on to development so it'll get fixed for the next build.

    Thanks!
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    I'd assume that since they're both drawn from the same set of data, that fixing the problem in the source view will probably fix it in the hierarchy view.
  • I'm also having difficulty with the hierarchy and source code results. It doesn't seem that the hit counts shown in these views match. Looking at the application entry point (Main()), the hierarchy view shows 2 hits and the source code view shows 1. This also occurs with other functions called from within Main.

    Latest version is installed (2.5.0.492) - can send screenshots or saved results if required.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello John,

    This thread really should have been locked, so I apologise for that. The issue at the top of the thread has been fixed and has since been included in Profiler 2.5 so I can say with reasonable certainty that your problem is unrelated to this one.

    Feel free to send the results to support (at) red-gate.com and we'll have a look. In the meantime, I'm closing this topic, so hopefully you'll email us and we can have a look at the problem outside of the forum.
This discussion has been closed.