Strange hit counts on if statements

I'm not sure if this is deliberate, but the hit counts on my if statements seem to be the sum of the number of times the condition was evaluated plus the number of times the condition evaluated to true.

eg.:

for (int i = 0; i < 100; i++)
{
if (i % 2 == 0 ) { // Hit count on this line is 150
doStuff();
}
}

This is a little confusing. I woudl except it to show the number of times the statement was evaluated (100) and I can get the number of times it was true from the next line. It seems strange to see a method that was called 300 times has a condition that looks like it was evaluated 600 times!

Comments

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

    I think this happens because ANTS Profiler considers every potential breakpoint as a 'line of code'. So a statement and a curly-brace on the same line gets counted twice. Please see here for more information.
Sign In or Register to comment.