MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Using sp-stress

Sp-stress contains utilities that create an artificial system load (CPU, memory and IO use) while other tests are done. This is useful when you want to verify that your application works also when the system is being stressed.

The utilities are:

  • cpuload: generates a specified load (per second approximation) according to a specified value. The exact CPU load depends on a number of conditions but, in general, it should stay within <10 per cent of the specified value.
    • If you specify 0 as the parameter value, a fluctuating random load is generated (33-99 per cent).
    • -s option is used to set the scheduling priority or policy (requires root).
  • memload: occupies a specified amount of memory. Several instances can be used to adjust the system memory consumption.
  • swpload: stresses the kernel virtual memory subsystem by creating clients that access memory pages with configurable patterns.
  • flash_eater: allocates disk space on the file system so that only a configurable amount of free space is left. This can be used to test how programs react to disk full situations. Do not use it as a root user on the root file system as full root file system may prevent system from booting.
  • run_secs: convenience wrapper script for running any of the load tools for a specified length of time and then exiting.

Note: CPU and memory utilisation is limited by the container group to which they are assigned. By default, that is the background applications group.

Packages

source: sp-stress

binary: sp-stress

Installing sp-stress on the Harmattan device

Prerequisite: Developer mode must be enabled.

  1. Select Settings > Security > Developer mode.
  2. Install the Test Automation 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 tool

CPU load

To create a 30 per cent CPU load on the system, enter the following command:

# cpuload 30

To create a 60 per cent CPU load for 20 seconds, enter the following command:

# run_secs 20 cpuload 60

Memory load

To consume 20 megabytes of memory, enter the following command:

# memload 20