Skip Headers
Oracle® Java Micro Edition Software Development Kit Developer's Guide
Release 8 for Windows
E50624-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

10 Profiling Applications

Oracle Java ME SDK 8 supports performance profiling for Java ME applications. The profiler keeps track of every method in your application. For a particular emulation session, the profiler figures out how much time was spent in each method.

Oracle Java ME SDK 8 supports offline profiling. Data is collected during the emulation session. After you close the emulator, you can export the data to an NPS file you can load and view later. As you view the snapshot you, can investigate particular methods, classes, and packages, and save a customized snapshot (a PNG file) for future reference.

You can start a profiling session from NetBeans IDE 8.0, as described in Collecting and Saving Profiler Data in the IDE or from the command line. It is important to understand that profiling data produced from the command line has a different format (PROF) than data produced from the NetBeans IDE 8.0 profiler (NPS).


Note:

This feature might slow down the execution of your application.


Profiling data from Oracle Java ME SDK 8 projects is displayed in NetBeans IDE on a tab labeled cpu with the name of the file or the time the data was displayed. The cpu tab opens when a profiled application stops. Because only performance profiling is supported, the Profiler window has limited usefulness for MEEP applications.

Collecting and Saving Profiler Data in the IDE

This procedure describes interactive profiling.


Note:

The profiler maintains a large amount of data, so profiled IMlets place greater demands on the heap. To increase the Heapsize property, see Chapter 5, "Working with Devices."


To run the profiler:

  1. In the Projects widow, right-click the project you want to profile and select Profile.

    If this is the first time profiling this project, you are prompted to integrate the profiler. Click Yes to perform the integration.

  2. Select CPU Profiler and click Run.

  3. Profiling data is displayed in a tab labeled cpu with the time the data was displayed.

  4. To export the profile data to an NPS file, click the Export to button and specify the file name and location. This data can be reloaded at a later time. See Loading an NPS File.

  5. To save the current view to a PNG file, click the Save current view to image button and specify a file name and location.

Loading an NPS File

To retrieve profile data from a previously exported NPS file (see Collecting and Saving Profiler Data in the IDE):

  1. Open the Profile menu and select Load Snapshot.

  2. Select the NPS file.

The Profiler opens in its own tab labeled cpu with the name of the file.


Note:

The profiling values obtained from the emulator do not reflect the actual values on an external device.


Importing PROF File

A PROF file created from the command line can be loaded in NetBeans IDE 8.0. The following example shows what a profiling session command might look like:

emulator.exe -Xdevice:EmbeddedDevice1 -Xdescriptor:"C:\Documents and Settings\user\My Documents\NetBeansProjects\SomeDemo\dist\Games.jad" -Xprofile:file=C:\temp\SomeDemo.prof

Files created from the command line are formatted differently from the NPS files created as described in Collecting and Saving Profiler Data in the IDE

To retrieve command-line profile data in NetBeans:

  1. Open the File menu and select Open File.

  2. Select the PROF file and click Open.

    The Profiler displays the data as a text file.