Repository navigation
Closed
Labels
in-progressWork is actively in progressWork is actively in progress
Description
Parent
What to build
Add Android native profiling collectors under the consolidated perf family. This issue groups Android work because Simpleperf, Perfetto, package/PID resolution, adb command execution, artifact pulling, and profileability hints share the same platform seams.
Prototype CLI shape:
agent-device perf cpu profile start --kind simpleperf --out cpu.perf.data
agent-device perf cpu profile stop --kind simpleperf --out cpu.perf.data
agent-device perf cpu profile report --kind simpleperf --out cpu-report.json
agent-device perf trace start --kind perfetto --out app.perfetto-trace
agent-device perf trace stop --kind perfetto --out app.perfetto-traceExpected agent experience:
- Agents first run
perf metricsorperf framesto confirm the symptom. - Agents escalate to Simpleperf for CPU-bound native slowness.
- Agents escalate to Perfetto for broader timeline, frame, scheduling, or system trace evidence.
- Commands return compact summaries and artifact paths, never full trace dumps in model context.
Acceptance criteria
- Android app sessions can resolve the active package and target process ids needed for profiling.
-
perf cpu profile start|stop|report --kind simpleperfcaptures a bounded CPU profile artifact and returns a compact top-function or report summary when possible. -
perf trace start|stop --kind perfettocaptures a bounded Perfetto artifact using a conservative app-focused config. - Commands fail with actionable hints when Simpleperf, Perfetto, app profileability, package identity, or process state is unavailable.
- Artifact-producing commands return local or daemon artifact paths plus small JSON metadata.
- Compose-specific trace guidance is optional and gated by app/runtime support; it is not required for the base Perfetto collector.
- heapprofd/native allocation tracing is either implemented only if the Perfetto plumbing makes it cheap, or explicitly deferred to the memory diagnostics issue.
Validation
- Android platform unit tests with mocked adb, Simpleperf, and Perfetto command output.
- Provider-backed session scenario for command translation and artifact lifecycle.
-
pnpm check:unit -
pnpm format
Blocked by
Metadata
Metadata
Assignees
Labels
in-progressWork is actively in progressWork is actively in progress
Activity
thymikee commentedon Jun 10, 2026
Implementation note for #694 rollout workers:
Please treat agent-friendly, token-efficient output as a core requirement, not a nice-to-have.
During review we should treat unbounded raw output or huge default JSON payloads as actionable feedback.
thymikee commentedon Jun 12, 2026
Correction: my previous closure-audit comment was mangled by shell interpolation of Markdown backticks. This is the corrected merged-main verification record.
Closure audit from merged main: I consider this issue closable.
Verified against
origin/mainat48c121d5eafter #757 merged:pnpm build.Pixel_9_Pro_XL_API_37headless emulator; verified Android boot complete and openedcom.android.settingsin sessionclosure-696.perf metrics --jsonreturned compact startup/fps/memory/cpu evidence with top memory consumers and bounded frame windows.perf frames --jsonreturned compact frame-health evidence.perf trace start --kind perfetto --out /private/tmp/agent-device-closure-696.perfetto-trace --jsonstarted forcom.android.settingswith app PID and artifact path only.perf trace stop --kind perfetto --jsonproduced/private/tmp/agent-device-closure-696.perfetto-traceat 3,089,640 bytes and returned compact summary metadata plus the explicit note to open the Perfetto artifact for timeline root cause.perf cpu profile start --kind simpleperfagainst bothcom.android.settingsand installedcom.justforfun.neoncity; this emulator deniedperf_event_open, and the command returned the intended actionable hint to use a debuggable/profileable app or permissive image.pnpm exec vitest run src/platforms/android/__tests__/perf.test.ts src/daemon/handlers/__tests__/session-observability.test.ts src/daemon/handlers/__tests__/session-close-shutdown.test.ts src/__tests__/client.test.ts-> 4 files, 73 tests passed.closure-696session and shut down the emulator.Scope check: this is minimal and useful as a first-pass Android perf triage lane. It returns compact defaults, artifact paths, and unavailable hints; raw Perfetto/Simpleperf artifacts stay on disk for native tools.
thymikee commentedon Jun 12, 2026
Scheduled the non-blocking follow-up from the closure audit: #785.
This is maintenance/refactor work only. It should not block closing this issue because Android perf metrics, frames, and Perfetto start/stop were verified on a real emulator. The Simpleperf positive path remains device/app dependent, and the current unavailable response was verified to return an explicit actionable hint.
thymikee commentedon Jun 13, 2026
Closing after the merged-main closure audit and follow-up split/refactor work.
Current scope is complete as the Android native perf 80% triage lane:
Anything beyond this, such as deeper Perfetto analysis, heapprofd/native allocation tracing, or native-tool-grade investigation workflows, should stay in follow-up issues and native debuggers rather than expanding this issue.