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.
PKDebug 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”.
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.
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.
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:
The database connection process is often slow. Although you might not be able to speed this up, you might be able to enhance the user’s perception of performance by moving the database connection process to a different place in your application.
Use profiling to tune algorithms. Fixing algorithmic yields greater performance enhancements than changing single lines of code.
Enhancing the efficiency of a function is not as effective as removing unneeded calls to that function.
Focus on optimizing the routines that are called most often.
If you cannot speed up a routine, consider adding some user feedback such as a progress bar.