Optimize source code using the BlackBerry Profiler
Use the BlackBerry® IDE Profiler tool to optimize your code. The Profiler tool displays the percentage of time spent in each code area to the current point of execution.
Note: To improve the reliability of results when you run the profiler application, exit other Microsoft Windows applications.
Set profile options
- In the profile pane, click Options.
- On the General tab, set the following options:
- To change the colors used for source code highlighting, click the Colors tab .
Generate profile data
- Set a breakpoint at the start of the section of code to profile.
- Set a breakpoint at the end of the section of code to profile.
- On the Debug menu, click Go.
- In the BlackBerry® Smartphone Simulator, run the application. The debug tool pauses the application when it reaches the first breakpoint.
- On the View menu, click Profile.
- In the profile pane, click Options.
- Select the type of method attribution, a sorting method, and the type of information to profile.
- Click OK.
- In the profile pane, click Clear. The profiler data is removed and the running time of Java® code is reset to 0.
- On the Debug menu, click Go.
- In the BlackBerry Smartphone Simulator, run the application. The debugger pauses the application when it reaches the second breakpoint.
- If the profile pane is not visible, on the View menu, click Profile.
- In the profile pane, click Refresh. All accumulated profile data is retrieved from the Java VM. Profiler data is not cleared, so running a application again adds to the data.
· Use profile views to view information about the section of code that you just ran.
- Click Save to save the contents of the profile pane to a comma separated values (.csv) file
View profile data
The profile pane has three views. Each view contains details about an item of execution (such as a method), the percentage of time spent running the item, and the number of times the item was run.
- On the View menu, click Profile.
- Click one of the following view tabs:
Save the contents to a file
The contents of the pane are saved to a comma-separated values (.csv) file. Contents are saved as they are displayed.
Clear profile data
> In the profile pane, right-click, and then click Clear.
Related topic