Trace UI is a Python application for capturing, replaying, and post-processing Android graphics traces. It supports both the Qt GUI and a non-GUI CLI flow.
- Make tracing on Android faster, easier, and more reliable.
- Standardize trace generation and replay workflows.
- Support both interactive GUI use and scriptable CLI use.
Requirements:
- Python 3.6 or newer.
adbinPATHfor Android capture and replay commands.- A connected Android device for capture and replay flows.
git clone ...
cd traceui
pip install pandas pyside6==6.7.0If you are not using a virtual environment, run the install command with sudo -H.
To run fast-forward verification, ensure ImageMagick is installed:
apt install imagemagickLinux:
./run.sh [--loglevel debug|info|warning|error|critical]This checks for updates and then launches the GUI.
Use ./run.sh for normal use and python traceui.py for local development.
For local development without the updater:
python traceui.pyInstall the repository into your current environment in editable mode:
python -m pip install -e .This installs the traceui_cli console script into the active environment. After that, the CLI entry point is:
traceui_cliList installed Android packages:
traceui_cli capture list-packages
traceui_cli capture list-packages --device <serial>Generate a sample config file:
traceui_cli capture sample-config
traceui_cli capture sample-config -o config.jsonSee Capture/Replay Config File for the sample config structure and field meanings.
Trace capture:
traceui_cli capture setup \
--plugin gfxr \
--app com.example.game \
-c config.json \
--launch-app \
--loglevel debugNotes:
--pluginis required forcapture setupand must begfxrorpatrace.gfxrcaptures produce.gfxrtrace files andpatracecaptures produce.pattrace files.--appaccepts either the exact package name or a resolvable app name.--launch-applaunches the app after trace setup completes.-cand--configare equivalent. If omitted, the plugin uses its current defaults.capture setupwrites a capture session state JSON file thatcapture stopuses to recover the selected plugin, device, target app, and plugin-specific capture state.- By default, the session state file is written to
tmp/traceui_cli_capture_session.json. --state-fileis optional and mainly useful for keeping separate capture sessions, for example when tracing on multiple devices in parallel.capture stopuses the stored session state and does not take--plugin.capture stopremoves the session state file after a successful trace pull.
Stop capture and pull the trace:
traceui_cli capture stop
traceui_cli capture stop --app com.example.game
traceui_cli capture stop -o tmp/output_tracesReplay a local trace:
traceui_cli replay \
tmp/example.gfxr \
-c config.json \
--screenshots \
-o tmp/replay-output \
--loglevel infoNotes:
- The trace path is a required positional argument.
- The replay plugin is resolved automatically from the trace suffix.
-cand--configare equivalent and are used to apply config-driven device path overrides before replay starts.devicepaths.replayfrom the config controls where the trace is pushed on the Android device.--screenshotsenables screenshot capture during replay.--compare-frame FRAMEreplays the trace twice, captures that frame once per run, and compares the two screenshots with ImageMagick.--compare-frameand--screenshotsare mutually exclusive.--intervalcontrols screenshot interval when--screenshotsis enabled and cannot be used with--compare-frame. When omitted, the screenshot interval defaults to 10. Setting--intervalto0disables screenshot capture.-oand--outdirare equivalent.- Frame comparison writes
compare_run1_frame_<N>.png,compare_run2_frame_<N>.png, anddiff_frame_<N>.pngtooutdir. - A visual diff is reported in command output but still exits successfully; operational failures still exit nonzero.
Compare a single frame between two replay runs:
traceui_cli replay \
tmp/example.gfxr \
--compare-frame 1550 \
-c config.json \
-o tmp/replay-output \
--loglevel infoGenerate a fast-forwarded trace from a local source trace:
traceui_cli fastforward \
tmp/example.gfxr \
-sf 1550 \
-c config.json \
-o tmp/fastforward-output \
--loglevel infoNotes:
--plugindefaults toauto; if you override it, usegfxrorpatrace.- The trace path is a required positional argument.
-cand--configare equivalent and are used to apply config-driven device path overrides before fast-forward generation starts.-sfand--start-frameare equivalent and required.-efand--end-frameare equivalent and optional. If omitted, the generated fast-forward trace runs to the end of the source trace.-oand--outdirare equivalent.- The CLI fastforward command currently generates and pulls the fast-forward trace; screenshot/HWC verification remains GUI-only.
The CLI sample config contains shared devicepaths and per-plugin config under plugin.
Example:
{
"devicepaths": {
"layer": "/data/local/debug",
"replay": "/sdcard/devlib-target",
"capture": "/data"
},
"plugin": {
"gfxreconstruct": {
"setprops": {
"debug.gfxrecon.page_guard_align_buffer_sizes": true,
"debug.gfxrecon.page_guard_persistent_memory": true,
"debug.gfxrecon.capture_file_timestamp": true,
"debug.gfxrecon.capture_frames": ""
},
"custom_setprops": {
"debug.example.extra_prop": "1"
}
},
"patrace": {}
}
}Meaning:
devicepaths.layer: base device path used for layer deployment.devicepaths.replay: device replay working directory.devicepaths.capture: base device capture directory.plugin.gfxreconstruct.setprops: built-in configurable GFXR trace setup properties.plugin.gfxreconstruct.custom_setprops: extra arbitrary setprops to apply during GFXR capture setup.plugin.patrace: currently supports shareddevicepathsonly.
For gfxreconstruct:
- Boolean entries in
setpropsenable or disable those built-in setprops. debug.gfxrecon.capture_framesis a string.- An empty string for
debug.gfxrecon.capture_framesmeans no frame filter. - Legacy flat GFXR config with top-level
setpropsandcustom_setpropsis still accepted for compatibility.
Logs are written to timestamped files under logs/ in the repo root, for example logs/traceui_YYYY-MM-DD_HH-MM-SS.log.
./run.sh, capture setup, replay, and fastforward support:
--loglevel debug|info|warning|error|criticalLocal outputs are written under tmp/ by default unless a command-specific output path is provided.