开发者

Delphi trace tool

I was wondering if there's a tool or a component for Delphi that can trace method execution line by li开发者_开发知识库ne and create a log file. With this kind of tool it is easy to compare how method performs on two sets of input data by comparing two log files.

EDIT:

Let's say there is a function


10: function MyFunction(aInput: Integer): Integer;
11: begin
12:   if aInput > 10 then
13:     Result := 10
14:   else
15:     Result := 0;
16: end;

I'm looking for a tool that would give the log which whould be similar to the following:

When aInput parameter is 1:


Line 10: 'function MyFunction(aInput: Integer): Integer;'
Line 11: 'begin'
Line 12: 'if aInput > 10 then'
Line 15: 'Result := 0;'
Line 16: 'end;'

and when aInput parameter is 11:


Line 10: 'function MyFunction(aInput: Integer): Integer;'
Line 11: 'begin'
Line 12: 'if aInput > 10 then'
Line 13: 'Result := 10;'
Line 16: 'end;'

The only information that should be required by the tool is the function name.

It's like stepping through the method under debugger, but in an automatic manner with logging every line of code.


SmartInspect and CodeSite

You can read this question for more review about those and others.


If you are looking for a free solution, I've used TraceTool before. The viewer is written in Delphi, and you can also use TraceTool with C#, C++, ActiveX, and Java. With Delphi, you simply include a couple of helper units and add the appropriate logging as you go. It supports logging text, as well as objects and their data.

You can download it from SourceForge here.

Delphi trace tool

Or, if you want something simpler and lighter weight for just primarily string output, you can always use OutputDebugString and view the output with TraceTool's viewer or with DbgView from SysInternals.


After some time searching I can conclude that there's no such tool for Delphi.


Perhaps a 'delphi profiler' will be useful. There are many suggested on stackoverflow.

Depending on the the profiler you will know what percent of aInput goes through each part of the if-then-else in your example and how long it takes to go through each section. Many profilers have logging., smartInspect for example., but I have not tried it.


Maybe you can do it (partial) with "Delphi code coverage"? (traces which lines are executed and which not) http://code.google.com/p/delphi-code-coverage/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜