Setting MIDP tracing and speed options

Note: Enabling traces would not be possible in this release of the SDK and so the MIDP monitor tab is not available for this release. To know all the limitations in this release of the SDK, refer to

Known issues and limitations section.

To achieve the best performance in MIDlet development, the SDK allows you to set up MIDP tracing and MIDlet speed for monitoring your MIDlet applications.

Setting up tracing to file

The MIDP tracing is handled by redirecting the output of the SDK to a log file. To capture the tracing information into a file, monitoring to file must be started in the CLI, using the output redirection functionality. Although you can select what to trace from the SDK Preferences, you cannot start the tracing to file from the SDK’s Preferences dialog. You must first create the log file.

To start the tracing:

  1. Use, for example, the following: in the bin folder, enter emulator > o:\log.xxxx.

    An SDK instance starts, which prints the output to a file named log.xxxx in o-drive.

  2. From the Emulator menu bar, navigate to Tools > Preferences. The General tab will be selected by default, click on the MIDP Monitor tab to view options for:

    • tracing the performance of a MIDlet

    • controlling the speed at which it runs.

    These tracing options can also be set in the CLI. See Options for tracing Java runtime.

Selecting tracing options

In either the Preferences window or the CLI, set the tracing options you want to capture to the log file. These tracing options trace events that occur in the KVM. (To view events that occur between the SDK and an external entity, such as a gateway simulator or Internet, see Analyzing SDK traffic and events.)

To view the log file, you can use, for example, the standard text editor which is provided with your PC’s operating system. Note that the log file exists for viewing purposes of the SDK’s output stream only, and editing it does not affect the SDK behaviour or the MIDlets.

To use tracing options within an IDE, you must set the tracing options within the IDE. Using tracing options and breakpoints within an IDE lets you trace specific sections of code in a MIDlet. To see if the IDE you are using supports tracing, refer to the IDE documentation.

Note: Selecting too many tracing options can slow down the SDK.

About MIDlet speed controls

When you run a MIDlet on a fast computer, you might not get an accurate demonstration of how the MIDlet runs on a device, because the simulation usually runs faster on the computer than it does on the device. MIDlet speed controls (KVM and Canvas speed) let you slow down the performance of a MIDlet on a computer to better reflect the MIDlet’s performance on a device. Developing a MIDlet in an environment with a slower KVM or canvas delay speed can help you monitor and optimize your code.

Note: Turning on the canvas speed and KVM speed simultaneously can adversely affect the data you collect, because canvas speed and KVM speed both control the speed of the SDK executable in ways that can conflict.

For example, if you test a MIDlet game with an intricate graphical display that requires frequent updating, and you slow down the canvas speed to better simulate the graphical display on a device: Simultaneously slowing down the KVM speed also slows down the canvas speed, so the performance of the MIDlet is distorted and the data you receive is inaccurate.

Adjusting the KVM speed control affects the canvas speed, but adjusting the canvas speed control does not affect the KVM speed.

Setting MIDlet canvas speed

Use the MIDlet canvas speed delay slider to slow down a MIDlet that displays too rapidly on a fast computer. This setting is recommended for a MIDlet with an active graphical display that requires frequent updating (for example, a game).

Move the slider to the right to increase the delay in milliseconds of the canvas paint function. Because the maximum delay you can set is 100 milliseconds, this setting has no visible effect, unless the canvas repaint rate of an object is significantly greater than 10 times per second.

Setting MIDlet KVM speed

Use this slide setting to regulate the speed of the bytecode instructions in the KVM, which is the speed at which a MIDlet runs. This setting is recommended for a MIDlet whose graphical display does not need to be updated frequently (for example, an application that calculates a mathematical equation and displays the result).

While this setting can be helpful, the KVM speed control does not provide a reliable way to gauge the actual speed of a MIDlet on a device. To be certain, test the MIDlet on a device.

A value of 0 (zero) indicates this feature is turned off and that the KVM is running at maximum speed. The maximum delay is 100 microseconds.