| Rahul Ravikumar | 9911e91 | 2022-09-23 11:17:21 -0700 | [diff] [blame] | 1 | # Introduction |
| 2 | |
| 3 | A Gradle Plugin to build and generate benchmarking results for KMP iOS benchmarks. |
| 4 | |
| 5 | * Generates Skia Dashboard compatible results. |
| 6 | * Automatically generates the XCode project, and runs benchmarks on a target device running iOS |
| 7 | or macOS (simulator or physical devices). |
| 8 | |
| 9 | # Usage |
| 10 | |
| 11 | A KMP project needs to do something like: |
| 12 | |
| 13 | ```groovy |
| 14 | plugins { |
| 15 | id("androidx.benchmark.darwin") |
| 16 | } |
| 17 | ``` |
| 18 | |
| 19 | and then it can use the `darwinBenchmark` block like so: |
| 20 | |
| 21 | ```groovy |
| 22 | darwinBenchmark { |
| 23 | // XCodegen Schema YAML |
| 24 | xcodeGenConfigFile = project.rootProject.file( |
| 25 | "benchmark/benchmark-darwin-samples-xcode/xcodegen-project.yml" |
| 26 | ) |
| 27 | // XCode project name |
| 28 | xcodeProjectName = "benchmark-darwin-samples-xcode" |
| 29 | // iOS app scheme |
| 30 | scheme = "testapp-ios" |
| Rahul Ravikumar | 6f7a311 | 2023-10-31 14:28:34 -0700 | [diff] [blame] | 31 | |
| 32 | // Destination |
| Rahul Ravikumar | 26673fb | 2023-11-03 11:16:38 -0700 | [diff] [blame] | 33 | destination = "platform=iOS Simulator,name=iPhone 13,OS=15.2" |
| Rahul Ravikumar | 6f7a311 | 2023-10-31 14:28:34 -0700 | [diff] [blame] | 34 | // Or a target device id |
| Rahul Ravikumar | 9911e91 | 2022-09-23 11:17:21 -0700 | [diff] [blame] | 35 | destination = "id=7F61C467-4E4A-437C-B6EF-026FEEF3904C" |
| Rahul Ravikumar | 6f7a311 | 2023-10-31 14:28:34 -0700 | [diff] [blame] | 36 | |
| Rahul Ravikumar | 9911e91 | 2022-09-23 11:17:21 -0700 | [diff] [blame] | 37 | // The XCFrameworkConfig name |
| 38 | xcFrameworkConfig = "AndroidXDarwinSampleBenchmarks" |
| 39 | } |
| 40 | ``` |
| 41 | |
| 42 | Example metrics look like: |
| 43 | |
| 44 | ```json |
| 45 | { |
| 46 | "key": { |
| 47 | "testDescription": "Allocate an ArrayList of size 1000", |
| 48 | "metricName": "Memory Peak Physical", |
| 49 | "metricIdentifier": "com.apple.dt.XCTMetric_Memory.physical_peak", |
| 50 | "polarity": "prefers smaller", |
| 51 | "units": "kB" |
| 52 | }, |
| 53 | "measurements": { |
| 54 | "stat": [ |
| 55 | { |
| 56 | "value": "min", |
| 57 | "measurement": 0.0 |
| 58 | }, |
| 59 | { |
| 60 | "value": "median", |
| 61 | "measurement": 0.0 |
| 62 | }, |
| 63 | { |
| 64 | "value": "max", |
| 65 | "measurement": 0.0 |
| 66 | }, |
| 67 | { |
| 68 | "value": "stddev", |
| 69 | "measurement": 0.0 |
| 70 | } |
| 71 | ] |
| 72 | } |
| 73 | } |
| 74 | ``` |