Add guide for enabling TFLite tracing on Android platform.

PiperOrigin-RevId: 328870155
Change-Id: I13fbd8d694eed1e4aa0641933cfbf88b63968bf6
This commit is contained in:
Juho Ha 2020-08-27 20:35:16 -07:00 committed by TensorFlower Gardener
parent 78c4212ad5
commit 9b28aa9e2e
2 changed files with 26 additions and 1 deletions
tensorflow/lite/g3doc/performance

View File

@ -38,6 +38,12 @@ has a built-in profiler that shows per operator profiling statistics. This can
help in understanding performance bottlenecks and which operators dominate the
computation time.
You can also use
[TensrFlow Lite tracing](measurement.md#trace_tensorflow_lite_internals_in_android)
to profile the model in your Android application, using standard Android system
tracing, and to visualize the operator invocations by time with GUI based
profiling tools.
## Profile and optimize operators in the graph
If a particular operator appears frequently in the model and, based on
@ -116,7 +122,7 @@ interpreter execution. TensorFlow Lite can use delegates by:
Be aware that some accelerators work better for different types of models. Some
delegates only support float models or models optimized in a specific way. It is
important to [benchmark](benchmarks.md) each delegate to see if it is a good
important to [benchmark](measurement.md) each delegate to see if it is a good
choice for your application. For example, if you have a very small model, it may
not be worth delegating the model to either the NN API or the GPU. Conversely,
accelerators are a great choice for large models that have high arithmetic

View File

@ -451,6 +451,25 @@ help notice where the inference call is made.
```
### Enable TensorFlow Lite tracing
To enable TensorFlow Lite tracing, set the Android system property
`debug.tflite.tracing` to 1 before starting the Android app.
```shell
adb shell setprop debug.tflite.trace 1
```
If this property has been set when TensorFlow Lite interpreter is initialized,
key events (e.g., operator invocation) from the interpreter will be traced.
After you captured all the traces, disable tracing by setting the property value
to 0.
```shell
adb shell setprop debug.tflite.trace 0
```
### Android Studio CPU Profiler
Capture traces with the