Add documentation for performance tools available for iOS (#10348)

* Add documentation for performance tools available for iOS

* Fix grammar
This commit is contained in:
Mykola Mokhnach
2018-03-14 13:48:33 +01:00
committed by GitHub
parent 30e7b45bdc
commit 4dcd49b41a

View File

@@ -0,0 +1,52 @@
## 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 meassure Simulator performance, since the `instruments` tool records the data from all running processes on the host machine.
#### Supported arguments
* _timeout_: For how long the recorder should be running in milliseconds. 5 minutes by default. Try not to set too high a value to this argument, since .trace files generated by `instruments` are pretty big in size.
* _profileName_: The name of an existing performance template. `Activity Monitor` by default.
#### Usage examples
```java
// 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
* _profileName_: The name of an existing performance template, for which the monitoring has been running before. `Activity Monitor` by default.
* _remotePath_: The path to a remote location, where the resulting zipped .trace file should be uploaded. The following protocols are supported: http/https, ftp. Null or empty string value (the default setting) means the content of resulting file should be zipped, encoded as Base64 and passed as the return value. An exception will be thrown if the generated file is too big to fit into the available server process memory.
* _user_: The name of the user for the remote authentication. Only works if `remotePath` is provided.
* _pass_: The password for the remote authentication. Only works if `remotePath` is provided.
* _method_: The http multipart upload method name. Only works if `remotePath` is provided. Equals to `PUT` by default.
#### Usage examples
```python
# Python
driver.execute_script('mobile: stopPerfRecord', {
'profileName': 'Time Profiler',
'remotePath': 'ftp://myserver/upload/',
'user': 'serveruser',
'pass': 'secretpass'
})
```