Lean on me

By: Bob Arnson

Abstract: When it comes to releasing quality software, everyone could use a little help from his friends. Enter TurboPower's Sleuth QA Suite, which promises to help you find bugs and optimize your Delphi and C++Builder code. By Bob Arnson.

Lean on me

When it comes to releasing quality software, everyone could use a little help from his friends. Enter TurboPower's Sleuth QA Suite, which promises to help you find bugs and optimize your Delphi and C++Builder code.

Everyone knows that with Delphi's try...finally statements, leaking memory, resources, and objects is a thing of the past. Of course, that assumes you always use try...finally, doesn't it? Er, yes. 

TurboPower's Sleuth QA Suite promises to make leaks and the bugs they cause disappear by finding them and pointing out where the leak occurs. Sleuth QA Suite is really two utilities: CodeWatch, the aforementioned leak-detection tool, and StopWatch, a profiling tool for performance analysis.

Leak detection

CodeWatch is a standalone utility that monitors your program as it runs, collecting controllable amounts of data about memory and resource allocations and calls to API functions. When you first run CodeWatch on a program, it prompts you to run a wizard to configure the amount of error detection it should do. Why wouldn't you always want the most error detection possible? Because the more detection CodeWatch performs, the more your program slows, as CodeWatch checks each allocation and API call. The only time I found performance to be too slow to be useful on a regular basis was when I enabled CodeWatch's API parameter logging feature. When parameter logging is enabled, CodeWatch records the thousands of API calls your code, the VCL, and other components make, so a slowdown isn't surprising.

CodeWatch provides a shortcut bar that makes it easy to switch among the views of CodeWatch's analysis of your programs:

  • A list of all the DLLs your program called, including version information
  • A list of API calls that failed, with a call stack that shows which lines of code led up to the failure
  • Debug output
  • A report that summarizes the program's errors
  • A list and chart that depicts the number of memory allocations
  • A memory leaks browser, with details and a call stack that shows which lines of code led up to the leak
  • A list and chart that depicts the number of resource allocations
  • A resource leaks browser, with details and a call stack that shows which lines of code led up to the leak

CodeWatch's different views make it very easy to focus on whatever kind of debugging you're interested in at the time. 

Performance analysis

StopWatch is similar in user interface and operation to CodeWatch. StopWatch is a standalone utility that collects performance information about your program as it runs. It too steps through a wizard when you first load a program. Because collecting accurate performance data can take a significant amount of time, StopWatch's wizard offers several ways to limit the amount of performance data that's collected. The easiest is StopWatch's trigger mode, which starts profiling only when a routine (function or procedure) you specify is called. When you start to look at performance analysis in a program, you probably have a pretty good idea of where to start looking, so having to manually specify where to start profiling isn't a major inconvenience.

Before running your program, StopWatch displays all the routines in your program in the Routines view. That's where you can specify which routines should trigger profiling or, if you're not using trigger mode, which routines shouldn't be profiled at all.

After running your program and collecting performance data, StopWatch shows the Profile view. The Profile view shows a lot of information, so StopWatch includes several ways of focusing on what you're interested in seeing. For example, you can use filters to show only the most-called routines or most time-consuming routines. You can also organize the view by module and scope, which helps pinpoint the performance of specific modules and classes in your code.

StopWatch also includes a Comparison view, which makes it easy to compare the results of two profiling sessions. For example, you can profile your app as it exists now, make a change you think will improve performance, then profile the app again -- proving whether the change actually improved performance.

Sleuth QA Suite at a glance

Why you want it Even with monster CPUs and gigs of RAM and virtual memory, the code you write should be as clean and as fast as you can manage in the time you have.
Why you need it Because shipping slow code or leaky code is just plain bad. If you can't be bothered to use CodeWatch on a regular basis, at least use it before you ship -- and then fix the leaks it finds! Your users will thank you...or maybe even give you more money in the future.

Coolest feature

Straightforward user interface makes a lot of complex information manageable.
Oddest feature Maybe it appeals to visual thinkers, but I didn't get much value from the charts in CodeWatch. There were frequently too many colors that were too similar to see much of a useful pattern.
Biggest missing feature CodeWatch integrated into the IDE. I'm a strong believer in using error-detection tools early in the development cycle -- when leaks will be few and easy to fix. I want to be able to turn on CodeWatch for normal debug sessions, so it's checking for leaks and API errors every time I debug.
Cost (US) per kilobyte (default install) 52.5¢
The details TurboPower Software Co.
Sleuth QA Suite v. 1.03
US$399
For all 32-bit versions of Delphi and C++Builder

Server Response from: ETNASC03