You copied the Doc URL to your clipboard.

Setting up an Android target

These instructions are specific to targets running Android.

Note

You can locate all of the files provided by DS-5 by selecting Help → ARM Extras... from the main menu.

Prepare and build your kernel

You must enable certain kernel configuration options to run Streamline. In the kernel configuration menu, use the arrow keys to navigate to the required submenu and press Enter. Each submenu is listed with the action you need to take within it.

General Setup

Make sure the Profiling Support option is enabled.

Kernel Hacking

In the Kernel Hacking submenu, navigate to the Tracers submenu and press Enter. Make sure the Trace process context switches option is enabled.

Kernel

Make sure Profiling Support is enabled.

Kernel Features

Make sure the High Resolution Timer Support is enabled. Enable Use local timer interrupts if you are using a Symmetric MultiProcessing (SMP) target.

If these options are not set correctly, you must change them and rebuild your kernel. If they are set correctly, you are ready to build and install the gator driver.

Build the gator daemon

The gator daemon and driver collect target metrics and then send them to your host machine.

Note

To build the gator daemon, you must install the Android NDK. For more information on how to do this, visit the Android NDK site.

To enable profiling, you must build and load the gator daemon on your target. Follow these steps to build the gator daemon from the source archive:

  1. Move to the directory that contains the gator daemon source:

    cd .../gator/daemon-src

  2. Enter the following commands to unzip the archive:

    tar -xzf gator-daemon.tar.gz

    Note

    You may need to use sudo in front of this command if you do not have privileges.

  3. Issue the following command:

    mv gator-daemon jni

  4. Issue the following command to build gatord:

    ndk-build

    Note

    If ndk is not on your path, instead issue the following command:

    execute /path/to/ndk/ndk-build.

  5. The newly created gatord is located in build_directory/libs/armeabi

Note

You must build the gator daemon on your gcc-enabled target or a Linux host. It is not possible to build the gator daemon on a Windows host.

Build the gator module

To use Streamline with your Android target, you must build the gator driver on a Linux host and place it in the same directory as the gator daemon, gatord, on the target file system. Transfer the gator driver module sources from your host to the target. They are located on your host here:

.../gator/driver-src/gator-driver.tar.gz

Assuming that you have unzipped the file and that you have all of the required tools for building kernel modules, enter the following command on your target to create the gator.ko module:

make -C kernel_build_dir M=`pwd` ARCH=arm CROSS_COMPILE=<...> modules

Note

To enable kernel stack unwinding you must remove the comment hashtag from the following line in the makefile of the gator module:

# EXTRA_CFLAGS +=	-DGATOR_KERNEL_STACK_UNWINDING

Note

You can build the gator module on your target. To do so, you do not need to include the ARCH or CROSS_COMPILE parameters. Enter the following command on your target: make -C kernel_build_dir M=`pwd`.

Connect to the target

Streamline supports connection to your target using ethernet. Using the Android Debug Bridge (ADB) utility that is part of the Android SDK, it is possible to forward a TCP port from the target to your localhost over a USB connection. ADB can also be configured to work over ethernet.

For more information about the Android SDK and ADB setup, see the Android website.

When ADB is set up, forward the Streamline port to your localhost using the following command:

adb forward tcp:8080 tcp:8080

Run the gator daemon on your target

Copy gatord and gator.ko into the file system on the target. If gatord is in a different directory than gator.ko on the target, you must include the path to gator.ko using the -m option of gatord. For example: ./gatord & -m home/gator/gator.ko.

Enter the following command to instantiate the gator driver.

insmod gator.ko

Now run gatord on the target:

./gatord &

You can use the following options with gatord:

-c

Sets the location of the configuration.xml file that defines the capture options. Include the directory location and the file name. This option is useful when directory containing gatord is not writeable.

-e

Defines the location of the events.xml file to use with gatord. events.xml defines the counters that Streamline collects during the capture session. Include the directory location and the file name.

-h

Lists all of the available gatord command line options.

-p

Sets the port number that gatord uses to communicate with the host.

-s

Defines the location of the session.xml file. Include the directory location and the file name. This option is most useful when performing a local capture. For more information, see Capturing data on your target.

-v

Displays the version information for gatord.

Note

To unload the gator daemon, determine the process id of gatord using ps -d | grep gatord and enter the kill command: kill process_id.

Set capture options to support your Android target

In the Capture Options dialog box, opened in the ARM Streamline Data view in Eclipse for DS-5 and enter the ethernet address. If you use the ADB to forward the port, enter Localhost in the Address field.

Note

With Android, make sure to add the shared libraries you are interested in profiling to the session using the Program Images section of the Capture Options dialog box.

Was this page helpful? Yes No