Thursday, January 17, 2008

Trace Parser small bug

Trace Parser is a new tool for profiling Dynamics Ax code. Unlike profiler, which makes execution of the code about 30 times slower, TraceParser takes extremely low resources - 4% according to Alexey Eremenko blog)

But since it is in the "beta" stage, there are some problems with usability and stability.

For example, when I run the "trace summary" menu item on my trace I've got an exception. It seems (thanks to reflector) the cause is in SqlTimeBreakDown function in SQL server Trace Parser database.

When I add condition to exclude division by zero, it results in empty
grid instead of exception.

This is the fix:

if @SQLTime>0  -- <<<<<<<<<<<<<<<< the fix
begin
INSERT INTO @BreakdownInformation
SELECT (sum(PrepDuration) * 100)/@SQLTime [% of time in SQL Prep],(
sum(BindDuration) * 100)/@SQLTime [% of time in SQL Bind],
(sum(RowFetchDuration) * 100)/@SQLTime [% of time in SQL Row Fetch],
(sum(ExecuteDuration) * 100)/@SQLTime [% of time in SQL Execution]
from SqlQueryInstance
WHERE traceId = @Traceid AND sessionid = @sessionid
end -- <<<<<<<<<<<<<<<< the fix
RETURN

No comments:

Post a Comment