Tuesday, March 1, 2011

Debugging Tips - @CLK

We can use ‘Watch’ window to get time information. @CLK can serve as a timer in your watch window. In many cases, we just want a rough idea of the time between two points, and @CLK makes it easy to find out how long it took to execute between two breakpoints. Please note that this time includes the debugger overhead. The trick is to enter @CLK in watch window, running time between two breakpoints will be added up to the current clock value. You can reset the value by typing @CLK=0 in watch window.
The time is in microseconds, to get time in milliseconds, set the @CLK to @CLK/1000. Although it is not a perfect timer, @CLK is good enough for some general guesses.

Example:-
BEGIN_CODE
<- Add break point here (B1)
{
   
<<Code block>>
}
END_CODE
<- Add another break point here (B2)


Debug the code using F5. Once you reach B1, type @CLK in watch window which will display current clock value. Now type @CLK=0 in watch window to reset the clock. Now press F5 to continue, once the control reaches B2, watch window will show the time taken for executing code block between B1 and B2.

Note: This will not include the break time @B1.

Posted By : Junaij M

No comments:

Post a Comment

Post a Comment