-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Android system tracing #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
This guide describes how to enable system tracing in Android using Anbox Cloud. | ||
|
||
## Enable Android System Tracing | ||
|
||
1. To enable Android system tracing, add the `android.enable_tracing` flag into the feature file. In the Android container, run: | ||
|
||
```bash | ||
echo "android.enable_tracing" >> /var/lib/anbox/features | ||
``` | ||
2. Specify the category you want to trace in the Android system using the `debug.atrace.tags.enableflags` system property. The supported categories are defined in [trace.h](https://cs.android.com/android/platform/superproject/main/+/main:system/core/libcutils/include/cutils/trace.h;l=50?q=ATRACE_TAG_INPUT). | ||
|
||
For instance, to enable the graphics category, add the following to the `/var/lib/anbox/android.json` file: | ||
|
||
```json | ||
{ | ||
"hardware": "ranchu", | ||
"api_level": 31, | ||
"properties": [ "debug.atrace.tags.enableflags=2" ] | ||
} | ||
``` | ||
Comment on lines
+12
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not strictly necessary to define the property here. This is only needed if you want to trace system services. However if that is the intention you need to put it here. |
||
3. Launch an Anbox session and initiate tracing via the HTTP endpoint. This will not only trace the Anbox session but also capture events aggregated under the category specified in the above system property.: | ||
|
||
```bash | ||
curl --unix-socket /run/user/1000/anbox/sockets/api.unix --request POST --data '{"enable":true}' s/1.0/tracing | ||
``` | ||
After your desired tracing time, stop the tracing: | ||
```bash | ||
curl --unix-socket /run/user/1000/anbox/sockets/api.unix --request POST --data '{"enable":false}' s/1.0/tracing | ||
``` | ||
The resulting trace file is available in the response once tracing is disabled. The trace file should look similar to: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So... The file is not available then, the _path_to the file is available in the response. |
||
|
||
```json | ||
{ | ||
"metadata": { | ||
"path": "/var/lib/anbox/traces/anbox_884277.0" | ||
}, | ||
"status": "Success", | ||
"status_code": 200, | ||
"type": "sync" | ||
} | ||
``` | ||
|
||
|
||
4. Pull the trace file from the Android container: | ||
```bash | ||
lxc file pull <container>/var/lib/anbox/traces/anbox_884277.0 ./ | ||
``` | ||
Load the trace file into the [Perfetto UI](https://ui.perfetto.dev/) for visualisation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the "development container" to "Android container". Is it correct? Or should this be "In the Anbox instance"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android runs in a container nested in an instance (container or VM), so that seems accurate to me.