Skip to content

feat: add iOS device perf sampling#358

Merged
thymikee merged 11 commits intomainfrom
codex/ios-device-perf
Apr 7, 2026
Merged

feat: add iOS device perf sampling#358
thymikee merged 11 commits intomainfrom
codex/ios-device-perf

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Apr 7, 2026

Summary

Add physical iOS CPU and memory sampling to perf.

How it works:

  • session-perf keeps one cross-platform response shape and routes Apple sampling through the active session bundle ID.
  • macOS and iOS simulators keep the existing process-snapshot path based on host ps / simctl spawn ps.
  • Physical iOS devices now:
    1. resolve the installed app bundle URL with xcrun devicectl device info apps
    2. resolve the live process list with xcrun devicectl device info processes
    3. record two short xcrun xctrace record --template "Activity Monitor" captures
    4. export the activity-monitor-process-live table
    5. filter rows to the target app PID set, collapse duplicate rows per PID, derive CPU from cumulative CPU-time deltas, and report resident memory from the latest sample
  • Startup timing remains the open round-trip metric already exposed by perf.

Validation

pnpm format
pnpm check:quick
pnpm check:unit
pnpm clean:daemon
node --experimental-strip-types src/bin.ts --session adr-ios-pr-clean open AgentDeviceRunner --platform ios --device "thymikee-iphone"
node --experimental-strip-types src/bin.ts --session adr-ios-pr-clean appstate
node --experimental-strip-types src/bin.ts --session adr-ios-pr-clean perf
node --experimental-strip-types src/bin.ts --session adr-ios-pr-clean close

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-358/

Built to branch gh-pages at 2026-04-07 14:41 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48fa16c93a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +459 to +463
cpuTimeNs:
cpuTimeValues.length > 0 ? cpuTimeValues.reduce((total, value) => total + value, 0) : null,
residentMemoryBytes:
residentMemoryValues.length > 0
? residentMemoryValues.reduce((total, value) => total + value, 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Aggregate only latest sample per PID before summing metrics

summarizeIosDevicePerfSnapshot currently sums every matched row’s cpuTimeNs and residentMemoryBytes, but activity-monitor-process-live exports can include multiple rows for the same process within one capture (e.g., multiple timestamps or ref rows), so this double-counts cumulative CPU time and resident memory and can significantly over-report both metrics. This affects any device run where xctrace emits more than one row per PID; the snapshot should collapse to one row per PID (typically latest/max) before aggregation.

Useful? React with 👍 / 👎.

@thymikee thymikee merged commit 83db76f into main Apr 7, 2026
16 checks passed
@thymikee thymikee deleted the codex/ios-device-perf branch April 7, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants