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.

Select Settings > Security > Developer mode.

Install the Performance bundle package by clicking Install.

You get a notification screen that lists all the applications to be installed in the bundle package. To install, click OK.

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:

To run xresponse in the screen update monitoring mode, enter the following command:

xresponse -w 0 -i

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.

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:

Swipe to the Applications view on the device.

Simulate a tap on the icon that starts the application.

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:

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: