About tracing and profiling an application

You use tracing and profiling to debug and tune an application. When you run an application on the desktop or on a handheld device, you can generate an execution trace file. You use the trace file to create a profile of your application.

The profile shows you which functions and events were called by which other functions and events, how often they were called, when garbage collection occurred, when objects were created and destroyed, and how long each activity took to complete. This information helps you find errors in the application's logic and identify areas that you should rewrite to improve performance.

NotePKDebug tracing You can also generate a simple text trace file without timer values by checking Enable PKDebug Tracing in the System Options dialog box.

For more about PKDebug, see “Generating a trace file without timing information”.

When you can trace an application

You can create a trace file when you run an application in the design-time environment or from a standalone executable at runtime.

When you run an application with tracing turned on, PocketBuilder records a timer value in a data file every time a specific activity occurs. You control when logging begins and ends and which activities are recorded.

Creating profiles

After you have generated a trace file, you can create several different profiles or views of the application by extracting different types of information from the trace file.

PocketBuilder provides three profiling tools that create profiles (views) of the application for you, but you can also create your own analysis tools.

Using profiling to tune an application

Examining the profiles generated by the profiling tools tells you where the application is spending the most time. You can also find routines that are being called too often, routines being called that you did not expect to call, or routines that are not being called at all. Follow these suggestions for tuning an application: