You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/build-llama3-chat-android-app-using-executorch-and-xnnpack/6-build-android-chat-app.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ In this section, you will use a Android demo application to demonstrate local in
The `onnxruntime_perf_test` tool allows you to simulate inference and gather statistics. For example,
42
+
```bash
43
+
# Execute on the device
44
+
adb shell "/data/local/tmp/onnxruntime_perf_test -e cpu -m times -r 20 -s -Z -x 1 /data/local/tmp/<your_model>.onnx"
45
+
```
46
+
47
+
The command example set the arguments of the application as,
48
+
-`-e cpu` specifies the provider as cpu provider
49
+
-`-m times` specifies the test mode as “times”
50
+
-`-r 20` specifies the repeated times as 20
51
+
-`-Z` disallows thread from spinning during runs to reduce cpu usage
52
+
-`-s` shows statistics result
53
+
-`-x 1` sets the number of threads used to parallelize the execution within nodes as 1
54
+
55
+
You can try other arguments setting if you would like to.
56
+
57
+
### Step 3: Deep Dive into Operator Profiling
58
+
To see exactly how many milliseconds are spent on each operator, use the profiling flag `-p`.
59
+
```bash
60
+
adb shell "/data/local/tmp/onnxruntime_perf_test -p profile.json -e cpu -m times -r 5 -s -Z -x 1 /data/local/tmp/<your_model>.onnx"
61
+
adb pull /data/local/tmp/profile.json
62
+
```
63
+
64
+
The argument `-p` enables performance profiling during the benchmark run. When you provide this flag followed by a filename, ONNX Runtime will generate a JSON file containing a detailed trace of the model execution.
65
+
You can view the results by opening [perfetto tool](https://ui.perfetto.dev/), and loading the generated JSON file. This allows you to see a visual timeline of which operations took the most time.
66
+
You also can convert the JSON file to a CSV sheet by creating a python script.
0 commit comments