Skip to content

Commit 882e6ac

Browse files
author
dcbuilder.eth
committed
Update documentation for --release flag and iOS XCUITest features
- Add --release flag to BrowserStack examples in README.md - Update mobench-sdk README and rustdocs with --release recommendation - Update mobench CLI rustdocs with --release flag - Expand template READMEs with BrowserStack workflow and video capture info - Document benchmark report capture mechanism (5-second delay, JSON markers)
1 parent 2910b47 commit 882e6ac

File tree

8 files changed

+145
-7
lines changed

8 files changed

+145
-7
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ cargo add mobench-sdk inventory
3737
cargo mobench build --target android
3838
cargo mobench build --target ios
3939

40-
# Run a benchmark
40+
# Run a benchmark locally
4141
cargo mobench run --target android --function sample_fns::fibonacci
42+
43+
# Run on BrowserStack (use --release for smaller APK uploads)
44+
cargo mobench run --target android --function sample_fns::fibonacci \
45+
--devices "Google Pixel 7-13.0" --release
4246
```
4347

4448
## Configuration

crates/mobench-sdk/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ BrowserStack:
123123
export BROWSERSTACK_USERNAME=your_username
124124
export BROWSERSTACK_ACCESS_KEY=your_key
125125

126-
cargo mobench run --target android --function my_benchmark --devices "Google Pixel 7-13.0"
126+
# Use --release for BrowserStack (smaller APK: ~133MB vs ~544MB debug)
127+
cargo mobench run --target android --function my_benchmark \
128+
--devices "Google Pixel 7-13.0" --release
127129
```
128130

129131
## Examples (Repository)

crates/mobench-sdk/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
//! # Build for iOS
5959
//! cargo mobench build --target ios
6060
//!
61-
//! # Run on BrowserStack
61+
//! # Run on BrowserStack (use --release for smaller APK uploads)
6262
//! cargo mobench run --target android --function my_expensive_operation \
63-
//! --iterations 100 --warmup 10 --devices "Google Pixel 7-13.0"
63+
//! --iterations 100 --warmup 10 --devices "Google Pixel 7-13.0" --release
6464
//! ```
6565
//!
6666
//! ## Architecture

crates/mobench-sdk/templates/android/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,34 @@ This is an auto-generated Android app for running Rust benchmarks on real device
88
# Build debug APK
99
./gradlew assembleDebug
1010

11-
# Build release APK
11+
# Build release APK (recommended for BrowserStack - ~133MB vs ~544MB debug)
1212
./gradlew assembleRelease
1313
```
1414

15+
## BrowserStack Testing
16+
17+
```bash
18+
# Build with mobench (use --release for smaller APK uploads)
19+
cargo mobench build --target android --release
20+
21+
# Run on BrowserStack
22+
cargo mobench run --target android --function my_benchmark \
23+
--devices "Google Pixel 7-13.0" --release
24+
```
25+
1526
## Running Benchmarks
1627

1728
The app reads benchmark configuration from:
1829
1. Intent extras (`bench_function`, `bench_iterations`, `bench_warmup`)
1930
2. `assets/bench_spec.json`
2031
3. Default values in code
2132

33+
## Benchmark Report Capture
34+
35+
The app captures benchmark results for BrowserStack:
36+
- Displays results on screen for 5 seconds (video capture)
37+
- Outputs JSON with `BENCH_JSON` marker to logcat
38+
2239
## Generated by
2340

2441
[mobench](https://crates.io/crates/mobench) - Mobile benchmarking SDK for Rust

crates/mobench-sdk/templates/ios/BenchRunner/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ xcodebuild -scheme BenchRunner -destination 'platform=iOS Simulator,name=iPhone
1515
xcodebuild -scheme BenchRunner -destination 'generic/platform=iOS' build
1616
```
1717

18+
## BrowserStack Testing
19+
20+
For BrowserStack testing, you need both the app IPA and the XCUITest runner:
21+
22+
```bash
23+
# Package the app as IPA
24+
cargo mobench package-ipa --method adhoc
25+
26+
# Package the XCUITest runner
27+
cargo mobench package-xcuitest
28+
29+
# Run on BrowserStack (use --release for smaller builds)
30+
cargo mobench run --target ios --function my_benchmark \
31+
--devices "iPhone 14-16" --release
32+
```
33+
1834
## Running Benchmarks
1935

2036
The app reads benchmark configuration from:
@@ -23,6 +39,13 @@ The app reads benchmark configuration from:
2339
3. `bench_spec.json` in bundle
2440
4. Default values in code
2541

42+
## Benchmark Report Capture
43+
44+
The app captures benchmark results for BrowserStack:
45+
- Displays results on screen for 5 seconds (video capture)
46+
- Outputs JSON with `BENCH_REPORT_JSON_START/END` markers
47+
- XCUITest extracts results via accessibility identifiers
48+
2649
## Generated by
2750

2851
[mobench](https://crates.io/crates/mobench) - Mobile benchmarking SDK for Rust

crates/mobench/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
//! # Run locally (no device required)
3636
//! cargo mobench run --target android --function my_benchmark --local-only
3737
//!
38-
//! # Run on BrowserStack
38+
//! # Run on BrowserStack (use --release for smaller APK uploads)
3939
//! cargo mobench run --target android --function my_benchmark \
40-
//! --iterations 100 --warmup 10 --devices "Google Pixel 7-13.0"
40+
//! --iterations 100 --warmup 10 --devices "Google Pixel 7-13.0" --release
4141
//! ```
4242
//!
4343
//! ## Commands

templates/android/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# {{PROJECT_NAME}} Android Benchmark App
2+
3+
This is an auto-generated Android app for running Rust benchmarks on real devices.
4+
5+
## Building
6+
7+
```bash
8+
# Build debug APK
9+
./gradlew assembleDebug
10+
11+
# Build release APK (recommended for BrowserStack - ~133MB vs ~544MB debug)
12+
./gradlew assembleRelease
13+
```
14+
15+
## BrowserStack Testing
16+
17+
```bash
18+
# Build with mobench (use --release for smaller APK uploads)
19+
cargo mobench build --target android --release
20+
21+
# Run on BrowserStack
22+
cargo mobench run --target android --function my_benchmark \
23+
--devices "Google Pixel 7-13.0" --release
24+
```
25+
26+
## Running Benchmarks
27+
28+
The app reads benchmark configuration from:
29+
1. Intent extras (`bench_function`, `bench_iterations`, `bench_warmup`)
30+
2. `assets/bench_spec.json`
31+
3. Default values in code
32+
33+
## Benchmark Report Capture
34+
35+
The app captures benchmark results for BrowserStack:
36+
- Displays results on screen for 5 seconds (video capture)
37+
- Outputs JSON with `BENCH_JSON` marker to logcat
38+
39+
## Generated by
40+
41+
[mobench](https://crates.io/crates/mobench) - Mobile benchmarking SDK for Rust
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# {{PROJECT_NAME_PASCAL}} iOS Benchmark App
2+
3+
This is an auto-generated iOS app for running Rust benchmarks on real devices.
4+
5+
## Building
6+
7+
```bash
8+
# Generate Xcode project (if using xcodegen)
9+
xcodegen generate
10+
11+
# Build for simulator
12+
xcodebuild -scheme BenchRunner -destination 'platform=iOS Simulator,name=iPhone 15' build
13+
14+
# Build for device
15+
xcodebuild -scheme BenchRunner -destination 'generic/platform=iOS' build
16+
```
17+
18+
## BrowserStack Testing
19+
20+
For BrowserStack testing, you need both the app IPA and the XCUITest runner:
21+
22+
```bash
23+
# Package the app as IPA
24+
cargo mobench package-ipa --method adhoc
25+
26+
# Package the XCUITest runner
27+
cargo mobench package-xcuitest
28+
29+
# Run on BrowserStack (use --release for smaller builds)
30+
cargo mobench run --target ios --function my_benchmark \
31+
--devices "iPhone 14-16" --release
32+
```
33+
34+
## Running Benchmarks
35+
36+
The app reads benchmark configuration from:
37+
1. Environment variables
38+
2. Launch arguments
39+
3. `bench_spec.json` in bundle
40+
4. Default values in code
41+
42+
## Benchmark Report Capture
43+
44+
The app captures benchmark results for BrowserStack:
45+
- Displays results on screen for 5 seconds (video capture)
46+
- Outputs JSON with `BENCH_REPORT_JSON_START/END` markers
47+
- XCUITest extracts results via accessibility identifiers
48+
49+
## Generated by
50+
51+
[mobench](https://crates.io/crates/mobench) - Mobile benchmarking SDK for Rust

0 commit comments

Comments
 (0)