How can we help you today? How can we help you today?

Bug in how time is shown in summary

This is for all the 3 sections in summary.

Slowest line of code may not be the slowest line of code. It's the same case with 'Slowest method' and 'Sowest method with children'.

For eg. take the fillowing code.
    Private Sub Form1_Load(....)
	Dim lng as Long
	    For lng = 1 To 1000
                MyMethod()
	    Next lng
    End Sub

    Private Sub MyMethod()
        Dim lng As Long
        For lng=1 to 3
                'some code
                MySubMethod()
            End If
        Next lng
    End Sub

    Private Sub MySubMethod()
        'some code
    End Sub
The line containing the call for the method MyMethod is being called a thousand times. Ants profiler is showing the hit count as 1000 and time(sec) as 294. Now this line is being shown in the summary section 'Slowest lines of code' with the time shown as 294.4116 seconds. That is not correct. 294.4116 is sum of seconds for calling the same line of code for a thousand times.

Now in the same eg. the method MyMethod is called 1000 times and method MySubMethod is called 3000 times. MySubMethod was returned as the slowest method(263.6964 seconds) but the time shown here is the result after calling the method 3000 times. MyMethod was shown as the second slowest method(30.7013 seconds) as a result of being call 1000 times. This is wrong. We are looking for the slowest method in a single call.
This is also the case with 'Slowest methods with children'.
sangha
0

Comments

3 comments

  • richardjm
    What ANTS records is the total time spent in the method. We don't record the individual time every time a method is entered as that would be very slow to record and use vast amounts of memory.

    However if you go to the All methods tab you can see the columns for Time and Time with Children. The first shows the total time spent executing just the code in the method and the second shows the total time spent including calls to sub methods. There are also three hidden columns which are Minimum Time, Average Time and Maximum Time. You can get at this information by right clicking on the column headers on the All Methods view and selecting Choose Columns. This should give you all the information you should need I would hope, then you can group, sort and filter the view to your hearts content.

    Hope this helps

    Richard
    richardjm
    0
  • sangha
    Found the hidden columns. Maybe the Maximum time/Average time column can be used in summary for the 3 sections.
    sangha
    0
  • richardjm
    sangha wrote:
    Found the hidden columns. Maybe the Maximum time/Average time column can be used in summary for the 3 sections.

    It's a good thought. I'll talk to the UI guys and see what they say. I think certainly in the next version.
    richardjm
    0

Add comment

Please sign in to leave a comment.