MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Using sp-smaps

The SMAPS data shows how much process data is clean or read-only, how much is shared, and, most importantly, how much of it is private for the process.

The sp-smaps-measure package contains the sp_smaps_snapshot tool for saving the whole device memory usage SMAPS data from /proc/PID/smaps files, with some additional information about the corresponding processes.

The sp-smaps-visualize package contains the following utilities for analysing smaps data captured by sp-smaps-measure:

  • sp_smaps_analyze: Reads raw (.cap) sp_smaps_snapshot captured data and provides a detailed view of the system, process, and object memory usage in the HTML format.
  • sp_smaps_appvals: Reads raw (.cap) sp_smaps_snapshot captured data and produces a CSV memory usage table for all applications that are described there.
  • sp_smaps_diff: Displays differences in application memory usage between smaps capture files. The verbosity of generated diff data can be controlled by the diff level and the minimum difference settings.
  • sp_smaps_filter: Processes captured smaps files in different ways.
  • sp_smaps_flatten: Reads raw capture files generated with sp_smaps_snapshot and tries to detect and remove duplicate entries due to multiple threads.
  • sp_smaps_normalize: Reads smaps snapshots and writes CSV format data that can be imported to spreadsheet programs or sp_smaps_analyze and similar tools.

In addition, you can use the sp_smaps_sorted_totals script to show totals for given SMAPS field values of memory mappings that match a given regular expression.

Note: The sp-endurance tool also uses sp_smaps_snapshot. The sp-endurance-postproc parses the private and dirty memory from the generated smaps.cap files.

Packages

source: sp-smaps

binary: sp-smaps-measure , sp-smaps-visualize

Installing sp-smaps-measure and sp-smaps-visualize on the Harmattan device

Install the tools through the developer mode applet.

Prerequisite: Developer mode must be enabled.

  1. Select Settings > Security > Developer mode.
  2. Install the Resource usage analysis bundle package by clicking Install.
  3. You get a notification screen that lists all the applications to be installed in the bundle package. To install, click OK.
  4. A dependency notice appears. Click Accept.

For more information on developer mode and installable tools, see Activating developer mode.

Using the tools

Note: For more detailed instructions and usage examples, enter the following command:

sp_smaps_filter --help
You can also refer to the manual pages of each utility.

You can use the sp-maps utilities to capture memory consumption information and analyse the data. This section provides examples of using the sp-maps utilities with an example log file called after_boot.cap.

Saving data to a log file

To save data to a log file called after_boot.cap, enter the following command:

# sp_smaps_snapshot > after_boot.cap

The tool writes the output (such as head -2000 /proc/[1-9]*/smaps) to the file.

Displaying the data in HTML format

To create an HTML file of the example data, enter the following commands on the host workstation:

$ sp_smaps_analyze after_boot.cap
$ firefox after_boot.html

Displaying the data as a CSV table

To create a CSV memory usage table of the example data, enter the following command:

$ sp_smaps_appvals after_boot.cap

The output after_boot.apps file can then be opened, for example, with the OpenOffice.org Calc software.

Displaying differences in application memory usage

To compare private, shared and clean memory for all snapshots in the current directory, enter the following command:

$ sp_smaps_diff *.cap -o diff.csv

Displaying totals for given processes

To show much each of the processes listed in after_boot.cap is swapped out, enter the following command:

$ sp_smaps_sorted_totals '.*' Swap after_boot.cap

Further information

For more information on the tools, see the following links: