MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Using xresponse

The xresponse tool measures application response times to user input and monitors application user interface (UI) updates. You can also verify when and how an application updates its UI. This helps you to find out if your application performs operations that considerably reduce its performance and device use time. For example, your application can update its UI when not requested by the user or update unnecessary parts of the UI.

The xresponse tool monitors the UI updates based on damage events. The X server damage extension reports every window update as damage to window content. The tool can also simulate user interaction using the X test extension.

You can also use xresponse to wait for a simple screen update scenario to happen (for example, a flow of updates to stop), which makes it useful for writing user action simulation scripts.

Packages

source: xresponse

binary: xresponse

Installing xresponse on the Harmattan device

Install xresponse through the developer mode applet.

Prerequisite: Developer mode must be enabled.

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

You can use xresponse, for example, to monitor screen updates, time application responses and screen updates, simulate keypresses, drag gestures, and simulate complex user actions in scripts. For a comprehensive list of the available commands, see the manual reference pages for the tool.

Note: When giving commands to the xresponse tool, the order of the options is important. The xresponse tool simulates the events in the order that they are given. For example, you must give -o/--logfile as the first option for it to work.

Monitoring screen updates

You can use xresponse to monitor the root window (default) or a specific application window. In Harmattan, xresponse reports all root window updates as full-screen updates (due to compositing or GL usage). Thus, it is not very useful to monitor just the root window. In Harmattan, you can only monitor non-fullscreen updates of windows that are in the background and switched to software rendering.

To monitor screen updates:

  1. To run xresponse in the screen update monitoring mode, enter the following command:
    xresponse -w 0 -i
  2. Use the application that you want to monitor.

To monitor a specific application window, use -a or -id switches. You can get the application "name" by doing either of the following:

  • Use the xprop|grep WM_CLASS and tap the application window on the device. The first WM_CLASS string is the relevant one.
  • Monitor updates to all applications with the -a '*' option.

The screen update areas are shown in the output in the "X geometry" format (width x height + X + Y).

Example

# xresponse -a '*' -w 0 -u

 Server Time:    Diff: Info
-----------------------------
2096592318ms:     0ms: Startup
2096592325ms:     7ms: Got damage event 864x480+0+0 from 0x4d (*SCREEN*)
2096592332ms:     7ms: Got damage event 864x102+0+0 from 0x220000d (mdecorator) 
2096592333ms:     1ms: Got damage event 864x480+0+0 from 0x100000d (meegotouchhome)  
2096592336ms:     3ms: Got damage event 864x64+0+0 from 0x1600012 (sysuid)
2096593392ms:  1056ms: Got damage event 864x480+0+0 from 0x100000d (meegotouchhome)  
2096593395ms:     3ms: Got damage event 864x480+0+0 from 0x4d (*SCREEN*)
2096593510ms:   115ms: Button 1 pressed at 0x0 (meegotouchhome)
2096593531ms:    21ms: Got damage event 864x480+0+0 from 0x100000d (meegotouchhome)  
2096593534ms:     3ms: Got damage event 864x480+0+0 from 0x4d (*SCREEN*)
2096593568ms:    34ms: Got damage event 864x480+0+0 from 0x100000d (meegotouchhome)  
2096593571ms:     3ms: Got damage event 864x480+0+0 from 0x4d (*SCREEN*)
2096593608ms:    37ms: Got damage event 864x480+0+0 from 0x100000d (meegotouchhome)  
2096593611ms:     3ms: Got damage event 864x480+0+0 from 0x4d (*SCREEN*)

Example

To monitor the calculator and notepad applications for damage events, enter the following command:

xresponse -w 0 -a calculator -a notepad

By default, xresponse uses the bounding box damage reporting level, which means that multiple damage events that occur in a short period of time are "packed" together and reported as a single damage event. The damaged area is equal to the bounding box of the "packed" events - hence the name. While this saves bandwidth and it is usually enough for analysis, you can also find out the exact damage events by setting the damage reporting level to raw with the -l switch.

Example

To monitor the calculator application for raw damage events, enter the following command:

xresponse -w 0 -a calculator -l raw

Timing application response and screen updates

You can use the following options to simulate taps:

  • -c defines where the taps take place.
  • -w defines how many seconds the tool must wait for the screen updates before terminating.
  • -u reports the application response time to user actions. The xresponse tool reports all user input events, including the ones that are not simulated.
    Example
    xresponse -w 0 -a calculator -u

To time the application startup:

  1. Swipe to the Applications view on the device.
  2. Simulate a tap on the icon that starts the application.
  3. Monitor the screen updates. With most applications, the application is fully initialised and ready for use when the last screen update occurs.
Example
xresponse -w 5 -c 200x20

Simulating keyboard actions

You can use xresponse to simulate pressing single keys and typing strings.

Examples

  • To simulate pressing the Tab key, entering the string Hello and pressing Enter, enter the following command:
 xresponse -k Tab,100 -t Hello -k Return,100
  • To simulate the keyboard actions with one second pauses in between, enter the following commands sequentially:
 xresponse -k Tab,100 -w 1
 xresponse -t Hello -w 1
 xresponse -k Return,100 -w 1
  • To create pauses that are shorter than one second, use the -b option. To simulate actions with pauses of 250 milliseconds between the events, enter the following commands:
 xresponse -k Tab,100 -b 250
 xresponse -t Hello -b 250
 xresponse -k Return,100 -b 250

Simulating swipe and drag gestures

You can use xresponse to simulate swipe and drag gestures with multiple points and varying delays between them. The application may not work as expected if the events are generated in either too short or long intervals or if there are too few events. Thus, you may need to experiment with different values to find the suitable number of points and delays between the points.

Example

To simulate a drag gesture with the delay of 100 milliseconds, enter the following command:

xresponse -d 400x475,100,400x300,400x200

Simulating complex user actions in scripts

You can use the following features for simulating complex scripts:

  • user input simulation with -c, -d, -t options
  • action response detection with -b option

Example

You want to simulate tapping the calculator button at the position of 600 x 400, which invokes a certain animation. You have previously verified that the delay between the updates is always less than 500 milliseconds. To simulate this action and wait for it to finish, enter the following command:

xresponse -w 0 -a calculator -c 600x400 -b 500

Further information

For more information on the tool, see the following link: