Have it your way

By: Bob Arnson

Abstract: QTime helps find sloppy code so that your users always have a snappy experience. By Bob Arnson.

Have it your way

QTime helps find sloppy code so that your users always have a snappy experience.

Moore's Law -- that IC transistor density and speed double every 12 to 18 months -- has at least two corollaries:

  • Software expands to fill available memory.
  • Software is getting slower more rapidly than hardware is getting faster.

QTime is a performance analysis and testing tool from AutomatedQA Inc. that promises to help diagnose and pinpoint performance problems in applications developed in Borland's Delphi and C++Builder, Borland C++, and Microsoft Visual C++.

Ye canna break the laws of software, laddie

To conduct its performance analysis, QTime requires an executable with debug information. Source code isn't required -- though with it, the tool displays performance information in the context of the code -- and QTime doesn't make any modifications to your source code.

QTime is a standalone tool; it integrates inside IDEs only by adding itself to the Tools menu. (I tested the integration with both Delphi 5 and Visual C++ 6.0.) When you load an executable, QTime opens a Setup panel that lets you specify which parts of your program you want to test. Because collecting performance information can be a lengthy process, you can save time by checking only certain modules, classes, and routines. QTime lets you arbitrarily group modules, classes, and routines, which makes it easy to profile the code you're interested in.

After you run a program, QTime displays the Results panel. On the left is a tree of the different runs of your program. The tool automatically saves a configurable number of runs and you can manually save any specific run. You can also compare and merge two different runs. QTime stores the different run types in the tree and lets you open any run to see its results.

On the right is a list of performance information by function. QTime offers several different views of performance information. For example, you can organize the results by class or file name, or filter the data to show only the top 10 time-consuming routines.

From the Results panel you can navigate to the other panels, which occupy the bottom part of the QTime window. The Details panel shows the parents and children of the function selected in the Results panel and provides performance information about them. (Parent functions are those that call a function; child functions are those that are called by the selected function.) Children are especially interesting because looking at their performance information can tell you at a glance where a function is spending its time.

The Editor panel shows source code annotated with the hit count -- the number of times a function was called -- and the percentage of time spent in the function. By default the Editor panel is read-only, but you can enable editing if you want to make changes. You'll need to return to your IDE to compile any changes you make, however.

The Graph panel is a bar chart of the functions listed in the Results panel. The chart can display results on multiple pages, but to get a good overview you'll probably want to use one of the top 10 Results views to restrict the number of elements in the chart. The default chart shows, by percent, how much time each function took. You can add and delete other types of charts and configure the display in excruciating detail.

The Disassembly panel shows source code mixed with disassembled code. Although per-instruction performance data isn't provided, the number of Pentium micro-ops is displayed. Icons identify calls, jumps, and returns; clicking the icons follows the path of the code.

Undercover work

The hit count information QTime gathers can also be used to determine how thoroughly your code has been tested. Unit and system tests that don't execute certain functions need to be beefed up. QTime's ability to merge runs means that you can run multiple tests and merge the results to get a view over time of how thoroughly your code has been tested.

QTime offers coverage profilers that work down to the line level. That means you can tell whether individual lines of code have been executed and -- assuming your tests are correct -- validated. QTime is missing advanced code-coverage features like branch, call-pair, and multiple-condition coverage.

I feel the need for speed

QTime is deficient in one major area: It is limited to providing performance information at the function level. With the Details panel noting the performance of child functions, there is sufficient information to give you a good idea of where to focus your performance-improvement efforts. However, from there your only recourse is to look at the micro-ops level in QTime's Disassembly panel. Line-level performance information would let you easily determine the execution time of calling component methods or API functions.

QTime's user interface can be a little overwhelming at times. I found that I could safely remove several toolbars, which presented fewer pieces of eye candy to distract me but didn't hamper routine use.

QTime includes a plug-in architecture that makes it possible for third-party developers to add both UI features and new profilers. The tool's profilers are built using the plug-in architecture. The profilers QTime ships with, in addition to those for timing and coverage, include:

  • a sampling profiler (for Windows NT only) to do line- and function-level performance profiling using sampling rather than time measurement.
  • a hit-count profiler, which provides line- and function-level hit-count information.
  • a VCL profiler that provides memory statistics of VCL objects.
  • a reference count profiler that provides memory statistics of interfaced objects.
  • a trace profiler that shows a real-time hierarchy of function calls.

QTime is available for online purchase for US$349 per developer.

Server Response from: ETNASC04