← Build iOS AppsCONTENT HISTORY

Update to Build iOS Apps

Snapshot Sep 30, 2026 · 23:18 UTC · version 0.1.2

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "name": "ios-ettrace-performance",
  "description": "Capture and interpret iOS Simulator ETTrace profiles. Use when profiling launch or runtime latency, comparing traces, or finding CPU-heavy stacks.",
  "included_files": [
    {
      "relative_path": "agents/openai.yaml",
      "size_in_bytes": 262
    },
    {
      "relative_path": "scripts/analyze_flamegraph_json.py",
      "size_in_bytes": 10762
    },
    {
      "relative_path": "scripts/collect_ios_dsyms.sh",
      "size_in_bytes": 6061
    }
  ],
  "skill_md_contents": "---\nname: ios-ettrace-performance\ndescription: Capture and interpret iOS Simulator ETTrace profiles. Use when profiling launch or runtime latency, comparing traces, or finding CPU-heavy stacks.\n---\n\n# iOS ETTrace Performance\n\nUse this skill to capture a focused, symbolicated ETTrace profile from an iOS simulator app. Pair it with `../ios-debugger-agent/SKILL.md` when the task also needs simulator build, install, launch, UI driving, logs, or screenshots.\n\n## Core Workflow\n\n1. Pick one focused flow and write down the expected start and stop points.\n2. Build the exact simulator app that will be installed and profiled.\n3. Temporarily link ETTrace into that app target for simulator/debug profiling.\n4. Collect UUID-matched dSYMs for the app executable and embedded dynamic frameworks.\n5. Capture one launch or runtime trace.\n6. Preserve the processed flamegraph JSON immediately after the run.\n7. Analyze only the processed JSON and report the flow, artifacts, hotspots, and caveats.\n\nAvoid broad \"use the app for a while\" captures. One trace should correspond to one user-visible flow.\n\n## Setup\n\nUse a writable run folder for each profiling session:\n\n```bash\nif [ -z \"${RUN_DIR:-}\" ]; then\n  RUN_DIR=\"$(mktemp -d \"${TMPDIR:-/tmp}/codex-ios-ettrace.XXXXXX\")\"\nfi\nmkdir -p \"$RUN_DIR\"\n```\n\nInstall the ETTrace runner CLI if it is not already available:\n\n```bash\nbrew install emergetools/homebrew-tap/ettrace\n```\n\n`ettrace` is the host-side macOS runner. The app must also link an `ETTrace.xcframework` for the iOS Simulator architecture.\nThis workflow is validated for ETTrace v1.1.0 processed `output_<thread>.json` files with top-level `nodes`.\n\n## Link ETTrace Into The App\n\nWire ETTrace into the exact app target being profiled. Keep the integration in a clearly temporary patch and remove it when the profiling task is done unless the user explicitly asks to keep it.\n\nPreferred options:\n\n- Reuse an existing simulator-compatible `ETTrace.xcframework` if the repo already vendors one.\n- If none exists, build a simulator-only copy into `RUN_DIR` from the upstream ETTrace package.\n- Link the framework directly into the app target, not only into tests, resources, data files, or a nested launcher target.\n- Confirm launch logs print `Starting ETTrace`.\n- Profile only one ETTrace-instrumented simulator app at a time because simulator mode listens on a fixed localhost port.\n\nBuild a simulator framework when needed:\n\n```bash\nETTRACE_TAG=\"${ETTRACE_TAG:-v1.1.0}\" # Override to match the installed runner when Homebrew updates.\nETTRACE_SRC=\"$RUN_DIR/ETTrace-src\"\nif [ ! -d \"$ETTRACE_SRC\" ]; then\n  git clone --depth 1 --branch \"$ETTRACE_TAG\" https://github.com/EmergeTools/ETTrace \"$ETTRACE_SRC\"\nfi\n\nrm -rf \"$RUN_DIR/ETTrace-iphonesimulator.xcarchive\" \"$RUN_DIR/ETTrace.xcframework\"\npushd \"$ETTRACE_SRC\" >/dev/null\nxcodebuild archive \\\n  -scheme ETTrace \\\n  -archivePath \"$RUN_DIR/ETTrace-iphonesimulator.xcarchive\" \\\n  -sdk iphonesimulator \\\n  -destination 'generic/platform=iOS Simulator' \\\n  BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n  INSTALL_PATH='Library/Frameworks' \\\n  SKIP_INSTALL=NO \\\n  CLANG_CXX_LANGUAGE_STANDARD=c++17\n\nxcodebuild -create-xcframework \\\n  -framework \"$RUN_DIR/ETTrace-iphonesimulator.xcarchive/Products/Library/Frameworks/ETTrace.framework\" \\\n  -output \"$RUN_DIR/ETTrace.xcframework\"\npopd >/dev/null\n```\n\nFor Bazel apps, a temporary import usually looks like:\n\n```python\nload(\"@rules_apple//apple:apple.bzl\", \"apple_dynamic_xcframework_import\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\napple_dynamic_xcframework_import(\n    name = \"ETTrace\",\n    xcframework_imports = glob([\"ETTrace.xcframework/**\"]),\n)\n```\n\nFor Xcode projects, temporarily add the simulator `ETTrace.xcframework` to the app target's Link Binary With Libraries / Embed Frameworks phases for the debug simulator build you are profiling, then remove that wiring after profiling.\n\n## Symbolication Gate\n\nDo not draw conclusions from an unsymbolicated flamegraph. Before every capture, prepare a dSYM folder that includes the app dSYM and any embedded first-party dynamic framework dSYMs.\n\nCollect dSYMs after the final build that produced the installed app:\n\n```bash\nSKILL_DIR=\"<absolute path to this loaded skill folder>\"\nAPP=\"<path-to-built-simulator-App.app>\"\nDSYMS=\"$RUN_DIR/dsyms\"\n\n\"$SKILL_DIR/scripts/collect_ios_dsyms.sh\" \\\n  --app \"$APP\" \\\n  --out-dir \"$DSYMS\" \\\n  --search-root \"$(dirname \"$APP\")\" \\\n  --search-root \"$PWD\" \\\n  --extra-dsym \"$RUN_DIR/ETTrace-iphonesimulator.xcarchive/dSYMs/ETTrace.framework.dSYM\"\n```\n\nAdd `--require-framework <FrameworkName>` for app-owned dynamic frameworks that must symbolicate; use `--require-all-frameworks` only when every embedded framework is app-owned or expected to have symbols. If the helper reports a missing required app or framework dSYM, rebuild the exact simulator app with dSYM generation before tracing, or add the build output directory that contains those dSYMs as another `--search-root`.\n\nVerify important UUIDs before tracing when the report looks suspicious:\n\n```bash\ndwarfdump --uuid \"$APP/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' \"$APP/Info.plist\")\"\nfind \"$DSYMS\" -maxdepth 1 -type d -name '*.dSYM' -print -exec dwarfdump --uuid {} \\;\n```\n\nAfter ETTrace exits, read its symbolication summary. Treat meaningful first-party \"have library but no symbol\" lines as a failed trace unless they are tiny noise. Unsymbolicated system-framework or ETTrace internal buckets are usually acceptable.\n\n## Capture\n\nFor launch traces:\n\n```bash\ncd \"$RUN_DIR\"\nCAPTURE_MARKER=\"$RUN_DIR/.ettrace-capture-start\"\n: > \"$CAPTURE_MARKER\"\nfind \"$RUN_DIR\" -maxdepth 1 \\( -name 'output.json' -o -name 'output_*.json' \\) -delete\nettrace --simulator --launch --verbose --dsyms \"$DSYMS\"\n```\n\nUse `--launch` only when measuring startup or first render. The first launch connection can force quit the app; relaunch from the simulator home screen rather than Xcode if prompted. For first-launch-after-install traces, temporarily set `ETTraceRunAtStartup=YES` in the app Info.plist, then run `ettrace --simulator` and launch from the home screen.\n\nFor runtime flow traces:\n\n```bash\ncd \"$RUN_DIR\"\nCAPTURE_MARKER=\"$RUN_DIR/.ettrace-capture-start\"\n: > \"$CAPTURE_MARKER\"\nfind \"$RUN_DIR\" -maxdepth 1 \\( -name 'output.json' -o -name 'output_*.json' \\) -delete\nettrace --simulator --verbose --dsyms \"$DSYMS\"\n```\n\nStart from a stable screen, start ETTrace, perform exactly one focused flow, wait until visible work is complete, then stop the runner. For wider attribution, add `--multi-thread`; otherwise start with the main thread.\n\nIn Codex, run `ettrace` with a TTY and answer prompts with `write_stdin`. Without a TTY, the runner can exit without a useful trace.\n\n## Preserve Outputs\n\nThe next ETTrace run can overwrite processed flamegraph files, so preserve fresh `output_<thread-id>.json` files immediately. Do not analyze a saved `output.json`; ETTrace also serves a viewer route with that name, and raw `emerge-output/output.json` files are not the processed flamegraph artifacts this workflow expects.\n\n```bash\nPRESERVED_DIR=\"$(mktemp -d \"$RUN_DIR/run-$(date +%Y%m%d-%H%M%S).XXXXXX\")\"\n: > \"$PRESERVED_DIR/summary.txt\"\nif [ ! -e \"$CAPTURE_MARKER\" ]; then\n  echo \"error: capture marker missing; start a fresh ETTrace capture before preserving outputs\" >&2\n  exit 1\nfi\nfind \"$RUN_DIR\" -maxdepth 1 -name 'output_*.json' -newer \"$CAPTURE_MARKER\" -print | while IFS= read -r json; do\n  preserved=\"$PRESERVED_DIR/${json##*/}\"\n  cp \"$json\" \"$preserved\"\n  {\n    echo \"## ${preserved##*/}\"\n    python3 \"$SKILL_DIR/scripts/analyze_flamegraph_json.py\" \"$preserved\"\n  } >> \"$PRESERVED_DIR/summary.txt\"\ndone\nif [ ! -s \"$PRESERVED_DIR/summary.txt\" ]; then\n  echo \"error: no fresh processed ETTrace output JSON found in $RUN_DIR\" >&2\n  exit 1\nfi\n```\n\nAnalyze only processed `output_*.json` files in `RUN_DIR`. Ignore `output.json` and raw `emerge-output/output.json` files unless debugging ETTrace itself. If the analyzer rejects the JSON shape, capture again with the Homebrew ETTrace runner and matching app-side `ETTrace.xcframework` tag instead of trying to interpret the rejected file.\n\n## Read The Profile\n\nStart from `run-*/summary.txt`, then inspect processed JSON directly if needed.\n\nReport:\n\n- exact flow, app build, simulator model/runtime, and run count\n- processed flamegraph JSON paths\n- top active leaves and inclusive first-party stacks with sample weights or percentages\n- whether symbols were complete for app-owned binaries\n- caveats such as first-run setup, simulator-only cost, network variance, or low sample count\n- before/after deltas only when the same flow was captured with comparable setup\n\n\n## Cleanup\n\nRemove temporary ETTrace app wiring when profiling is complete unless the user asked to keep it. Keep or discard run artifacts based on the active task.\n"
}

SHA-256: 5d58da640621ba9bbf45a7de03a26ba0b10a3ff34fe8791bd28750f6b49688e3