Options

Interpreting ANTS statistics

JMfxJMfx Posts: 2
i1430447_screenshot.jpg

I've got the output as shown above. But I'm not totally sure how to interpret the Time (sec.) statistic. For example, does line 347 mean that executing that line once takes 0.0008 seconds, or that it takes 0.0008 seconds to execute that line 1121 times (time to execute line * hitcount)?

As for line 339, the same question holds. Also, is this time statistic merely for the reader read method call, or also for the time it takes to complete the while loop. And if the answer is the second option, does this time statistic for line 339 include the time needed to execute the statements in the while loop body (i.e. line 342, 346, 347 and 350)?

Assuming the time statistic for line 339 is line * hitcount, a single reader read method call takes 0.0009 seconds (0.99/ 1122). That doesn't seem that bad to me, does it? So the only way to optimize this section would be to read less lines, right?

One final question: if I have a slow database query, where would this show when profiling using ANTS? Line 335 or line 339?

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Let's see if I can clarify some of your questions:
    I've got the output as shown above. But I'm not totally sure how to interpret the Time (sec.) statistic. For example, does line 347 mean that executing that line once takes 0.0008 seconds, or that it takes 0.0008 seconds to execute that line 1121 times (time to execute line * hitcount)?
    The time shown is the total running time for that line. It executed 1121 times in 0.0008 seconds.
    As for line 339, the same question holds. Also, is this time statistic merely for the reader read method call, or also for the time it takes to complete the while loop. And if the answer is the second option, does this time statistic for line 339 include the time needed to execute the statements in the while loop body (i.e. line 342, 346, 347 and 350)?
    Line-level timings relate tho the time taken to execute the line, not the block of code that may or may not occur after this line. So this time is the time taken to run readerChartDay.Read
    Assuming the time statistic for line 339 is line * hitcount, a single reader read method call takes 0.0009 seconds (0.99/ 1122). That doesn't seem that bad to me, does it? So the only way to optimize this section would be to read less lines, right?
    The best advice I can give is to maybe change your query so that it returns less data. Of course it may be related to network performance if the data is being read from a SQL Server on the network.
    One final question: if I have a slow database query, where would this show when profiling using ANTS? Line 335 or line 339?
    I think that ExecuteReader merely sets up a connection to read data; I do not think it actually runs the query. I'm not sure about that though. Maybe MSDN has some solid information about that.
Sign In or Register to comment.