Automating Performance Metrics Measurement

Apple provides the instruments tool with quite a rich set of features for desktop and mobile applications performance measurement. The collected data can be then visualized with Instruments.app, which is a part of Xcode DevTools. By default Xcode provides several measurement templates, like Activity Monitor or Time Profiler, but one can also create their own profiles and select a custom set of metrics to record and visualize. Read https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide to get a more detailed overwiew of available tool features.

mobile: startPerfRecord

This command starts the performance recorder for the given profile name (template) on the device under test. In case this command is called two or more times in a row then the previous recorder will be forcefully stopped and the new one will start. All the previous data will be lost.

Important: It is expected, that --relaxed-security command line parameter is set for the Appium server command line in order to measure Simulator performance, since the instruments tool records the data from all running processes on the host machine.

Supported arguments

Usage examples

// Java
Map<String, Object> args = new HashMap<>();
args.put("timeout", 60 * 1000);
args.put("profileName", "Time Profiler");
driver.executeScript("mobile: startPerfRecord", args);

mobile: stopPerfRecord

This command stops performance recorder for the given profile name (template) on the device under test and returns the collected data in zipped format or uploads it to a remote server. An exception will be thrown if startPerfRecord command has not been invoked before.

Important: It is expected, that --relaxed-security command line parameter is set for the Appium server command line in order to meassure Simulator performance, since the instruments tool records the data from all running processes on the host machine.

Supported arguments

Usage examples

# Python
driver.execute_script('mobile: stopPerfRecord', {
    'profileName': 'Time Profiler',
    'remotePath': 'ftp://myserver/upload/',
    'user': 'serveruser',
    'pass': 'secretpass'
})