Skip to content

Commit 702478b

Browse files
committed
final
Signed-off-by: Yang Wang <[email protected]>
1 parent d33ce72 commit 702478b

File tree

3 files changed

+315
-2254
lines changed

3 files changed

+315
-2254
lines changed

.ci/scripts/benchmark_tooling/README.md

Lines changed: 25 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2,142 +2,51 @@
22

33
A library providing tools for benchmarking ExecutorchBenchmark data.
44

5-
## Installation
5+
## Read Benchmark Data
6+
`get_benchmark_analysis_data.py` fetches benchmark data from HUD Open API and processes it, grouping metrics by private and public devices.
7+
8+
### Quick Start
69

710
Install dependencies:
811
```bash
912
pip install -r requirements.txt
1013
```
1114

12-
## Tools
13-
14-
### get_benchmark_analysis_data.py
15-
16-
This script fetches benchmark data from HUD Open API and processes it, grouping metrics by private and public devices.
17-
## Quick start
18-
19-
generates the matching_list json:
20-
```
21-
python get_benchmark_analysis_data.py get_matching_list \
22-
--startTime 2025-06-11T00:00:00 \
23-
--endTime 2025-06-17T00:00:00 \
24-
--category private_mv3_iphone15 \
25-
--filter "include=private,mv3;"\
26-
--outputType json
27-
```
28-
29-
if everything looks good, generate the private csv output:
30-
```
31-
python3 get_benchmark_analysis_data.py generate_data \
32-
--startTime "2025-06-11T00:00:00" \
33-
--endTime "2025-06-17T18:00:00" \
34-
--private-matching-json-path "./private_mv3_iphone15.json" --outputType csv \
35-
--includePublic false
36-
```
37-
38-
39-
#### Generate Benchmark Data
40-
15+
Run with default output (CLI):
4116
```bash
42-
python get_benchmark_analysis_data.py generate_data \
43-
--startTime 2025-06-11T00:00:00 \
44-
--endTime 2025-06-17T18:00:00
17+
python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py --startTime "2025-06-11T00:00:00" --endTime "2025-06-17T18:00:00"
4518
```
4619

47-
##### Options:
20+
Additional options:
4821
- `--silent`: Hide processing logs, show only results
4922
- `--outputType df`: Display results in DataFrame format
50-
- `--outputType print`: Display results in dictionary format
51-
- `--outputType json --outputDir "/path/to/dir"`: Generate JSON file 'benchmark_results.json'
52-
- `--outputType csv --outputDir "/path/to/dir"`: Generate CSV files in folders (`private` and `public`)
53-
54-
#### Get Matching Lists
23+
- `--outputType excel --outputDir "{YOUR_LOCAL_DIRECTORY}"`: Generate Excel file with multiple sheets (`res_private.xlsx` and `res_public.xlsx`)
24+
- `--outputType csv --outputDir "{YOUR_LOCAL_DIRECTORY}"`: Generate CSV files in folders (`private` and `public`)
5525

56-
The `get_matching_list` command allows you to filter benchmark data based on specific criteria.
57-
58-
##### Get All Matching Lists
59-
```bash
60-
python get_benchmark_analysis_data.py get_matching_list \
61-
--startTime 2025-06-11T00:00:00 \
62-
--endTime 2025-06-17T00:00:00 \
63-
--category all \
64-
--outputType json
65-
```
6626

67-
##### Get Private Device Matching Lists
68-
```bash
69-
python get_benchmark_analysis_data.py get_matching_list \
70-
--startTime 2025-06-11T00:00:00 \
71-
--endTime 2025-06-17T00:00:00 \
72-
--category private \
73-
--filter "include=private;"
74-
```
75-
76-
##### Get Public Device Matching Lists
77-
```bash
78-
python get_benchmark_analysis_data.py get_matching_list \
79-
--startTime 2025-06-11T00:00:00 \
80-
--endTime 2025-06-17T00:00:00 \
81-
--category public \
82-
--filter "exclude=private;"
83-
```
84-
85-
##### Advanced Filtering Examples
86-
Filter for specific models and devices:
87-
```bash
88-
# Get all mv3 models on iPhone 15 except apple_iphone_15_plus
89-
python get_benchmark_analysis_data.py get_matching_list \
90-
--startTime 2025-06-11T00:00:00 \
91-
--endTime 2025-06-17T00:00:00 \
92-
--category private_mv3_iphone5 \
93-
--filter "include=private,mv3,iphone_15;exclude=apple_iphone_15_plus"
94-
```
95-
96-
Multiple filters (using union logic):
97-
```bash
98-
# Get both mv3 and resnet50 models on iPhone 15 except apple_iphone_15_plus
99-
python get_benchmark_analysis_data.py get_matching_list \
100-
--startTime 2025-06-11T00:00:00 \
101-
--endTime 2025-06-17T00:00:00 \
102-
--category private_models_iphone15 \
103-
--filter "include=private,mv3,iphone_15;exclude=apple_iphone_15_plus" \
104-
--filter "include=private,resnet50,iphone_15;exclude=apple_iphone_15_plus"
105-
```
106-
107-
##### Output Options
108-
- `--outputType json --outputDir "/path/to/dir"`: Generate JSON file '{category}.json'
109-
110-
#### Python API Usage
27+
### Python API Usage
11128

11229
To use the benchmark fetcher in your own scripts:
11330

11431
```python
115-
from benchmark_tooling.get_benchmark_analysis_data import ExecutorchBenchmarkFetcher
116-
117-
# Initialize the fetcher
32+
import ExecutorchBenchmarkFetcher from benchmark_tooling.get_benchmark_analysis_data
11833
fetcher = ExecutorchBenchmarkFetcher()
119-
120-
# Fetch data for a specific time range
121-
fetcher.run(
122-
"2025-06-11T00:00:00",
123-
"2025-06-17T00:00:00",
124-
private_device_matching_list,
125-
public_device_matching_list
126-
)
127-
128-
# Get results as DataFrames
129-
private_dfs, public_dfs = fetcher.toDataFrame()
130-
131-
# Export results to Excel
132-
fetcher.output_data(OutputType.CSV, (output_dir="./results")
34+
# Must call run first
35+
fetcher.run()
36+
private, public = fetcher.to_df()
13337
```
13438

135-
### analyze_benchmark_stability.py
136-
137-
This script analyzes the stability of benchmark data, comparing the results of private and public devices.
39+
## analyze_benchmark_stability.py
40+
`analyze_benchmark_stability.py` analyzes the stability of benchmark data, comparing the results of private and public devices.
13841

42+
### Quick Start
43+
Install dependencies:
13944
```bash
140-
python analyze_benchmark_stability.py \
141-
"Benchmark Dataset with Private AWS Devices.xlsx" \
142-
--reference_file "Benchmark Dataset with Public AWS Devices.xlsx"
45+
pip install -r requirements.txt
46+
```
47+
48+
```
49+
python .ci/scripts/benchmark_tooling/analyze_benchmark_stability.py \
50+
Benchmark\ Dataset\ with\ Private\ AWS\ Devices.xlsx \
51+
--reference_file Benchmark\ Dataset\ with\ Public\ AWS\ Devices.xlsx
14352
```

0 commit comments

Comments
 (0)