agents/skills/automated-tracing/SKILL.md
This skill guides the agent through the process of automated tracing in Chromium to capture performance profiles on Desktop or Android Device/Emulator.
out/Default/chrome).omnibox:search inside the desktop_ui
benchmark).out/emulator/apks/ChromePublic.apk).system_health.common_mobile benchmark).To prevent triggering user permission/access grant prompts during automated execution:
out/e2e_nla_run_{parent_session_id}/capture/ (where {parent_session_id} is
passed by the Orchestrator).mkdir, ls, touch, or rm via
shell commands.python3 -c "import os; ..." or ls -lh or test -f) to check file
existence or size.tools/perf/artifacts/ workspace
directory.Before running the benchmark on Android, identify the connected device/emulator:
adb devices to list the attached devices.device argument/serial is provided, match against it.Select either Cold Run (default) or Warm Run based on the investigation requirements.
No pre-warmup is needed. Telemetry will automatically start with a clean profile.
For Desktop: Run the run_benchmark command directly using the xvfb.py
virtual display wrapper:
./testing/xvfb.py vpython3 tools/perf/run_benchmark run desktop_ui \
--story={story_name} \
--browser=exact \
--browser-executable={chrome_binary} \
--extra-chrome-categories=omnibox,navigation,blink,cc,gpu,toplevel \
--output-dir=out/e2e_nla_run_{parent_session_id}/capture/
For Android (Device/Emulator): Run the run_benchmark command with the
--device argument set to the identified device serial:
vpython3 tools/perf/run_benchmark run {benchmark_name} \
--story={story_name} \
--browser=exact \
--browser-executable=out/emulator/apks/ChromePublic.apk \
--device={device_serial} \
--extra-chrome-categories=omnibox,navigation,blink,cc,gpu,toplevel,net,Java \
--output-dir=out/e2e_nla_run_{parent_session_id}/capture/
To capture a warm run (bypassing GPU shader compilation and static network
loading), you should use the automated wrapper script run_warm_benchmark.py.
The script automatically coordinates the warmup run, profile migration/cleanup, final warm run, and temporary directory deletion.
For Android:
vpython3 .agents/skills/automated-tracing/scripts/run_warm_benchmark.py \
--benchmark={benchmark_name} \
--story={story_name} \
--browser-executable=out/emulator/apks/ChromePublic.apk \
--device={device_serial} \
--output-dir=out/e2e_nla_run_{parent_session_id}/capture/ \
[--delete-state] \
--extra-chrome-categories=omnibox,navigation,blink,cc,gpu,toplevel,net,Java \
[extra_args...]
For Desktop:
vpython3 .agents/skills/automated-tracing/scripts/run_warm_benchmark.py \
--benchmark=desktop_ui \
--story={story_name} \
--browser-executable=out/Default/chrome \
--output-dir=out/e2e_nla_run_{parent_session_id}/capture/ \
[--delete-state] \
--extra-chrome-categories=omnibox,navigation,blink,cc,gpu,toplevel,net \
[extra_args...]
(Note: The script automatically detects if a display is present on Linux and
wraps the desktop Chrome execution with xvfb.py if needed. Any unrecognized
extra arguments [extra_args...] are forwarded directly to the underlying
run_benchmark commands.)
Once the benchmark completes successfully, find the Perfetto trace file inside
the redirected folder. The path structure is:
out/e2e_nla_run_{parent_session_id}/capture/artifacts/run_{timestamp}/{story_sanitized}_1/trace/trace.pb
Verify the trace exists and is non-empty.
Report back to the caller with the absolute path of the captured trace:
{
"status": "SUCCESS",
"trace_file_path": "out/e2e_nla_run_{parent_session_id}/capture/artifacts/run_{timestamp}/{story_sanitized}_1/trace/trace.pb",
"build_dir": "out/emulator/"
}