
Ios Ettrace Performance
- 45 installs
- 4.9k repo stars
- Updated July 14, 2026
- openai/plugins
ios-ettrace-performance is an agent skill for capturing and analyzing symbolicated ETTrace profiles from iOS Simulator apps.
About
The ios-ettrace-performance skill captures focused, symbolicated ETTrace profiles from iOS Simulator apps. The workflow picks one user-visible flow, builds the exact simulator binary, temporarily links ETTrace.xcframework into the app target, collects UUID-matched dSYMs, captures one launch or runtime trace, and preserves processed output JSON before analysis. It installs the ettrace Homebrew runner, builds simulator frameworks from upstream ETTrace when needed, and gates analysis on complete symbolication for app-owned binaries. Launch traces use ettrace --simulator --launch while runtime flows perform one focused interaction then stop the runner. Processed output_<thread>.json files are copied immediately because later runs overwrite them, and analysis uses bundled analyze_flamegraph_json.py on fresh artifacts only. Reports include flow description, simulator details, top first-party stacks, symbol completeness, and caveats about simulator-only variance. Cleanup removes temporary ETTrace wiring unless the user requests otherwise. Use when profiling iOS Simulator launch or runtime latency with ETTrace flamegraphs.
- Requires one focused flow with symbolication before drawing performance conclusions.
- Links ETTrace.xcframework into the app target and collects matching dSYMs.
- Preserves fresh output_<thread>.json files immediately after each capture.
- Supports launch and runtime traces via ettrace --simulator with dSYM folder.
- Analyzes only processed flamegraph JSON using analyze_flamegraph_json.py.
Ios Ettrace Performance by the numbers
- 45 all-time installs (skills.sh)
- +3 installs in the week ending Jul 26, 2026 (Skillselion tracking)
- Ranked #608 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
ios-ettrace-performance capabilities & compatibility
- Capabilities
- ettrace framework linking for simulator builds · dsym collection and symbolication verification · launch and runtime trace capture · processed json preservation and analysis · hotspot reporting with simulator caveats
- Use cases
- testing · debugging
- Platforms
- macOS
What ios-ettrace-performance says it does
Do not draw conclusions from an unsymbolicated flamegraph.
One trace should correspond to one user-visible flow.
npx skills add https://github.com/openai/plugins --skill ios-ettrace-performanceAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 45 |
|---|---|
| repo stars | ★ 4.9k |
| Last updated | July 14, 2026 |
| Repository | openai/plugins ↗ |
How do I profile iOS Simulator app launch or runtime latency with ETTrace flamegraphs?
Capture symbolicated ETTrace profiles from iOS Simulator apps for launch or runtime latency analysis.
Who is it for?
iOS developers profiling simulator app performance for one focused launch or runtime flow.
Skip if: Skip for physical device profiling, API-only backends, or broad unstructured app usage traces.
When should I use this skill?
User asks to ETTrace profile, capture iOS simulator performance, or find CPU hotspots in an iOS app.
What you get
Preserved symbolicated flamegraph JSON, summary.txt hotspots, and a report with flow context and caveats.
Files
iOS ETTrace Performance
Use 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.
Core Workflow
1. Pick one focused flow and write down the expected start and stop points. 2. Build the exact simulator app that will be installed and profiled. 3. Temporarily link ETTrace into that app target for simulator/debug profiling. 4. Collect UUID-matched dSYMs for the app executable and embedded dynamic frameworks. 5. Capture one launch or runtime trace. 6. Preserve the processed flamegraph JSON immediately after the run. 7. Analyze only the processed JSON and report the flow, artifacts, hotspots, and caveats.
Avoid broad "use the app for a while" captures. One trace should correspond to one user-visible flow.
Setup
Use a writable run folder for each profiling session:
if [ -z "${RUN_DIR:-}" ]; then
RUN_DIR="$(mktemp -d "${TMPDIR:-/tmp}/codex-ios-ettrace.XXXXXX")"
fi
mkdir -p "$RUN_DIR"Install the ETTrace runner CLI if it is not already available:
brew install emergetools/homebrew-tap/ettraceettrace is the host-side macOS runner. The app must also link an ETTrace.xcframework for the iOS Simulator architecture. This workflow is validated for ETTrace v1.1.0 processed output_<thread>.json files with top-level nodes.
Link ETTrace Into The App
Wire 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.
Preferred options:
- Reuse an existing simulator-compatible
ETTrace.xcframeworkif the repo already vendors one. - If none exists, build a simulator-only copy into
RUN_DIRfrom the upstream ETTrace package. - Link the framework directly into the app target, not only into tests, resources, data files, or a nested launcher target.
- Confirm launch logs print
Starting ETTrace. - Profile only one ETTrace-instrumented simulator app at a time because simulator mode listens on a fixed localhost port.
Build a simulator framework when needed:
ETTRACE_TAG="${ETTRACE_TAG:-v1.1.0}" # Override to match the installed runner when Homebrew updates.
ETTRACE_SRC="$RUN_DIR/ETTrace-src"
if [ ! -d "$ETTRACE_SRC" ]; then
git clone --depth 1 --branch "$ETTRACE_TAG" https://github.com/EmergeTools/ETTrace "$ETTRACE_SRC"
fi
rm -rf "$RUN_DIR/ETTrace-iphonesimulator.xcarchive" "$RUN_DIR/ETTrace.xcframework"
pushd "$ETTRACE_SRC" >/dev/null
xcodebuild archive \
-scheme ETTrace \
-archivePath "$RUN_DIR/ETTrace-iphonesimulator.xcarchive" \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
INSTALL_PATH='Library/Frameworks' \
SKIP_INSTALL=NO \
CLANG_CXX_LANGUAGE_STANDARD=c++17
xcodebuild -create-xcframework \
-framework "$RUN_DIR/ETTrace-iphonesimulator.xcarchive/Products/Library/Frameworks/ETTrace.framework" \
-output "$RUN_DIR/ETTrace.xcframework"
popd >/dev/nullFor Bazel apps, a temporary import usually looks like:
load("@rules_apple//apple:apple.bzl", "apple_dynamic_xcframework_import")
package(default_visibility = ["//visibility:public"])
apple_dynamic_xcframework_import(
name = "ETTrace",
xcframework_imports = glob(["ETTrace.xcframework/**"]),
)For 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.
Symbolication Gate
Do 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.
Collect dSYMs after the final build that produced the installed app:
SKILL_DIR="<absolute path to this loaded skill folder>"
APP="<path-to-built-simulator-App.app>"
DSYMS="$RUN_DIR/dsyms"
"$SKILL_DIR/scripts/collect_ios_dsyms.sh" \
--app "$APP" \
--out-dir "$DSYMS" \
--search-root "$(dirname "$APP")" \
--search-root "$PWD" \
--extra-dsym "$RUN_DIR/ETTrace-iphonesimulator.xcarchive/dSYMs/ETTrace.framework.dSYM"Add --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.
Verify important UUIDs before tracing when the report looks suspicious:
dwarfdump --uuid "$APP/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$APP/Info.plist")"
find "$DSYMS" -maxdepth 1 -type d -name '*.dSYM' -print -exec dwarfdump --uuid {} \;After 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.
Capture
For launch traces:
cd "$RUN_DIR"
CAPTURE_MARKER="$RUN_DIR/.ettrace-capture-start"
: > "$CAPTURE_MARKER"
find "$RUN_DIR" -maxdepth 1 \( -name 'output.json' -o -name 'output_*.json' \) -delete
ettrace --simulator --launch --verbose --dsyms "$DSYMS"Use --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.
For runtime flow traces:
cd "$RUN_DIR"
CAPTURE_MARKER="$RUN_DIR/.ettrace-capture-start"
: > "$CAPTURE_MARKER"
find "$RUN_DIR" -maxdepth 1 \( -name 'output.json' -o -name 'output_*.json' \) -delete
ettrace --simulator --verbose --dsyms "$DSYMS"Start 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.
In Codex, run ettrace with a TTY and answer prompts with write_stdin. Without a TTY, the runner can exit without a useful trace.
Preserve Outputs
The 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.
PRESERVED_DIR="$(mktemp -d "$RUN_DIR/run-$(date +%Y%m%d-%H%M%S).XXXXXX")"
: > "$PRESERVED_DIR/summary.txt"
if [ ! -e "$CAPTURE_MARKER" ]; then
echo "error: capture marker missing; start a fresh ETTrace capture before preserving outputs" >&2
exit 1
fi
find "$RUN_DIR" -maxdepth 1 -name 'output_*.json' -newer "$CAPTURE_MARKER" -print | while IFS= read -r json; do
preserved="$PRESERVED_DIR/${json##*/}"
cp "$json" "$preserved"
{
echo "## ${preserved##*/}"
python3 "$SKILL_DIR/scripts/analyze_flamegraph_json.py" "$preserved"
} >> "$PRESERVED_DIR/summary.txt"
done
if [ ! -s "$PRESERVED_DIR/summary.txt" ]; then
echo "error: no fresh processed ETTrace output JSON found in $RUN_DIR" >&2
exit 1
fiAnalyze 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.
Read The Profile
Start from run-*/summary.txt, then inspect processed JSON directly if needed.
Report:
- exact flow, app build, simulator model/runtime, and run count
- processed flamegraph JSON paths
- top active leaves and inclusive first-party stacks with sample weights or percentages
- whether symbols were complete for app-owned binaries
- caveats such as first-run setup, simulator-only cost, network variance, or low sample count
- before/after deltas only when the same flow was captured with comparable setup
Cleanup
Remove 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.
interface:
display_name: "iOS ETTrace Performance"
short_description: "Profile symbolicated iOS simulator flows with ETTrace"
default_prompt: "Use $ios-ettrace-performance to capture a focused iOS simulator ETTrace profile and identify time-heavy stacks."
#!/usr/bin/env python3
"""Summarize ETTrace processed flamegraph JSON for performance triage.
This helper intentionally accepts only the Homebrew ETTrace v1.1.0 processed
flamegraph shape: one `output_<thread>.json` file with a top-level `nodes`
tree. ETTrace raw capture JSON usually lives under an `emerge-output/` temp
folder and has keys such as `threads` and `libraryInfo`; this script rejects
that shape because it has not been symbolicated into flamegraph nodes.
ETTrace v1.1.0 stores `duration` as inclusive time on every real frame and
appends an empty terminal child with zero duration to preserve same-name stack
buckets. The strict validation here is deliberate: a malformed or legacy file
should fail loudly instead of producing misleading hotspot evidence.
"""
from __future__ import annotations
import argparse
import json
import math
import sys
from collections import defaultdict
from pathlib import Path
from typing import Any
sys.setrecursionlimit(200_000)
IDLE_FRAMES = {
"mach_msg_trap",
"__psynch_cvwait",
"semaphore_wait_trap",
"kevent_id",
"__ulock_wait",
"__workq_kernreturn",
"__semwait_signal",
"nanosleep",
"poll",
"select",
"start_wqthread",
}
WRAPPER_FRAME_EXACT = {
"start",
"main",
"libsystem_kernel.dylib",
"UIApplicationMain",
"-[UIApplication _run]",
"GSEventRunModal",
"_CFRunLoopRunSpecificWithOptions",
"__CFRunLoopRun",
"__CFRunLoopDoSource0",
"__CFRunLoopDoSource1",
"__CFRunLoopServiceMachPort",
"__CFMachPortPerform",
"__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__",
"__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__",
"__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__",
"_dispatch_client_callout",
"_dispatch_main_queue_callback_4CF",
"_dispatch_main_queue_drain",
}
WRAPPER_FRAME_PREFIXES = (
"runApp<",
"closure #1 in App.",
)
APP_ENTRYPOINT_SUFFIXES = (
".$main()",
".main()",
".mainApp()",
)
def is_idle(frame: str) -> bool:
"""Return whether a frame represents a blocked or sleeping thread."""
return frame in IDLE_FRAMES
def is_unattributed(frame: str) -> bool:
"""Return whether ETTrace could not map a sample to a symbol."""
return frame == "<unattributed>"
def is_wrapper_frame(frame: str) -> bool:
"""Return whether an inclusive frame is generic app/run-loop scaffolding."""
if frame in WRAPPER_FRAME_EXACT:
return True
if any(frame.startswith(prefix) for prefix in WRAPPER_FRAME_PREFIXES):
return True
if frame.startswith("static ") and any(frame.endswith(suffix) for suffix in APP_ENTRYPOINT_SUFFIXES):
return True
return False
def matches_any_pattern(frame: str, patterns: tuple[str, ...]) -> bool:
"""Return whether a frame matches any case-insensitive focus substring."""
lowered = frame.lower()
return any(pattern.lower() in lowered for pattern in patterns)
def display_name(node: dict[str, Any]) -> str:
"""Return the frame name for one processed flamegraph node."""
return str(node.get("name") or "")
def children_of(node: dict[str, Any]) -> list[dict[str, Any]]:
"""Return child nodes while tolerating ETTrace's singleton-child variant."""
if "children" not in node:
raise ValueError("Processed ETTrace node is missing `children`.")
children = node["children"]
if isinstance(children, dict):
return [children]
if isinstance(children, list):
if not all(isinstance(child, dict) for child in children):
raise ValueError("Processed ETTrace node has a non-object child entry.")
return children
raise ValueError("Processed ETTrace node has invalid `children`.")
def node_weight(node: dict[str, Any]) -> float:
"""Return the inclusive `duration` stored on one ETTrace v1.1.0 node."""
if "duration" not in node:
raise ValueError("Processed ETTrace node is missing `duration`.")
value = node["duration"]
if isinstance(value, bool) or not isinstance(value, (int, float)):
raise ValueError("Processed ETTrace node has invalid `duration`.")
duration = float(value)
if not math.isfinite(duration):
raise ValueError("Processed ETTrace node has invalid `duration`.")
return duration
def collect_frame_weights(
node: dict[str, Any],
self_weights: dict[str, float],
inclusive_weights: dict[str, float],
) -> tuple[float, float]:
"""Aggregate self and active-inclusive weights from one flamegraph subtree."""
name = display_name(node)
weight = node_weight(node)
children = children_of(node)
child_weight = 0.0
child_active_weight = 0.0
for child in children:
total_child_weight, active_child_weight = collect_frame_weights(
child,
self_weights,
inclusive_weights,
)
child_weight += total_child_weight
child_active_weight += active_child_weight
active_weight = child_active_weight
if name and name != "<root>":
self_weight = max(weight - child_weight, 0)
if not children:
self_weight = weight
if self_weight > 0:
self_weights[name] += self_weight
if not is_unattributed(name) and not is_idle(name):
active_weight += self_weight
inclusive_weights[name] += active_weight
return weight, active_weight
def thread_root_node(payload: dict[str, Any]) -> dict[str, Any] | None:
"""Return the top-level `nodes` tree from ETTrace v1.1.0 processed JSON."""
root = payload.get("nodes")
if isinstance(root, dict):
return root
return None
def parse_flamegraph(path: Path):
"""Read processed ETTrace JSON and aggregate totals used by the report."""
with path.open(encoding="utf-8") as file:
payload = json.load(file)
if not isinstance(payload, dict):
raise ValueError("Processed ETTrace JSON must be an object.")
if "threadNodes" in payload:
raise ValueError(
"This looks like an intermediate or legacy ETTrace flamegraph shape with `threadNodes`. "
"Use Homebrew ETTrace v1.1.0 output_<thread>.json with top-level `nodes`.",
)
if "threads" in payload and "libraryInfo" in payload:
raise ValueError(
"This looks like ETTrace raw capture JSON, not processed flamegraph JSON. "
"Use the output_<thread>.json written in the directory where ettrace was run.",
)
thread_root = thread_root_node(payload)
if thread_root is None:
raise ValueError("Missing processed flamegraph nodes; this does not look like ETTrace flamegraph JSON.")
self_weights = defaultdict(float)
active_inclusive_weights = defaultdict(float)
total = 0.0
idle = 0.0
unattributed = 0.0
thread_summaries = []
thread_name = path.stem
thread_self_weights: dict[str, float] = defaultdict(float)
thread_inclusive_weights: dict[str, float] = defaultdict(float)
collect_frame_weights(thread_root, thread_self_weights, thread_inclusive_weights)
thread_total = sum(thread_self_weights.values())
thread_summaries.append((thread_total, str(thread_name)))
total += thread_total
for frame, weight in thread_self_weights.items():
self_weights[frame] += weight
if is_unattributed(frame):
unattributed += weight
continue
if is_idle(frame):
idle += weight
for frame, weight in thread_inclusive_weights.items():
if not is_unattributed(frame) and not is_idle(frame):
active_inclusive_weights[frame] += weight
return total, idle, unattributed, self_weights, active_inclusive_weights, thread_summaries
def print_top(
title: str,
rows: list[tuple[float, str]],
denominator: float,
limit: int,
percentage_label: str,
) -> None:
"""Print a ranked table where percentages use the requested denominator."""
print(f"\n{title}")
for weight, frame in rows[:limit]:
percent = weight / denominator * 100 if denominator else 0
print(f"{weight:10.6f} {percent:7.2f}%{percentage_label} {frame}")
def main() -> None:
"""Parse arguments, summarize the flamegraph, and print ranked sections."""
parser = argparse.ArgumentParser(
description="Summarize ETTrace processed flamegraph JSON, excluding idle self frames from active percentages.",
)
parser.add_argument(
"json",
type=Path,
help="Path to ETTrace v1.1.0 processed output_<thread>.json.",
)
parser.add_argument("--top", type=int, default=40, help="Number of rows to print per section.")
parser.add_argument(
"--pattern",
action="append",
dest="patterns",
help=(
"Inclusive-frame substring to include in the focused section. Can be repeated. "
"If omitted, all inclusive frames are shown."
),
)
parser.add_argument(
"--show-wrappers",
action="store_true",
help="Include app entrypoint, run loop, and other wrapper frames in inclusive output.",
)
args = parser.parse_args()
try:
total, idle, unattributed, self_weights, active_inclusive_weights, thread_summaries = parse_flamegraph(
args.json,
)
except (OSError, ValueError, json.JSONDecodeError) as error:
print(f"error: {error}", file=sys.stderr)
raise SystemExit(1)
active = total - idle - unattributed
patterns = tuple(args.patterns) if args.patterns else ()
print(f"Trace: {args.json}")
print(f"Total duration: {total:.6f}")
print(f"Idle self total: {idle:.6f}")
print(f"Unattributed total: {unattributed:.6f}")
print(f"Active total: {active:.6f}")
thread_summaries.sort(reverse=True)
print_top("Threads", thread_summaries, total, min(args.top, len(thread_summaries)), "total")
active_self_frames = [
(weight, frame)
for frame, weight in self_weights.items()
if not is_idle(frame) and not is_unattributed(frame)
]
active_self_frames.sort(reverse=True)
print_top("Top active self frames", active_self_frames, active, args.top, "active")
inclusive_rows = [
(weight, frame)
for frame, weight in active_inclusive_weights.items()
if not patterns or matches_any_pattern(frame, patterns)
if args.show_wrappers or not is_wrapper_frame(frame)
]
inclusive_rows.sort(reverse=True)
section_title = "Top focused inclusive frames" if patterns else "Top inclusive frames"
print_top(section_title, inclusive_rows, active, args.top, "active")
if __name__ == "__main__":
main()
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat >&2 <<'USAGE'
Usage: collect_ios_dsyms.sh --app App.app --out-dir DIR [options]
Collects UUID-matched dSYMs for a built iOS simulator app into DIR.
Required:
--app PATH Built .app bundle
--out-dir DIR Destination dSYM directory
Optional:
--search-root DIR Directory to search for .dSYM bundles (repeatable)
--extra-dsym DIR Known .dSYM bundle to include in candidates (repeatable)
--require-framework NAME Require a matching dSYM for an embedded framework
--require-all-frameworks Require matching dSYMs for every embedded framework
Example:
collect_ios_dsyms.sh --app build/Debug-iphonesimulator/MyApp.app \
--out-dir /tmp/profile/dsyms \
--search-root build \
--search-root ~/Library/Developer/Xcode/DerivedData
USAGE
}
require_value() {
local flag="$1"
local value="${2:-}"
if [[ -z "$value" ]]; then
echo "$flag requires a value" >&2
usage
exit 2
fi
}
app_path=""
out_dir=""
require_all_frameworks=false
search_roots=()
extra_dsyms=()
required_frameworks=()
while [[ $# -gt 0 ]]; do
case "$1" in
--app)
require_value "$1" "${2:-}"
app_path="$2"
shift 2
;;
--out-dir)
require_value "$1" "${2:-}"
out_dir="$2"
shift 2
;;
--search-root)
require_value "$1" "${2:-}"
search_roots+=("$2")
shift 2
;;
--extra-dsym)
require_value "$1" "${2:-}"
extra_dsyms+=("$2")
shift 2
;;
--require-framework)
require_value "$1" "${2:-}"
required_frameworks+=("$2")
shift 2
;;
--require-all-frameworks)
require_all_frameworks=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage
exit 2
;;
esac
done
if [[ -z "$app_path" || -z "$out_dir" ]]; then
usage
exit 2
fi
if [[ ! -d "$app_path" ]]; then
echo "error: app bundle not found: $app_path" >&2
exit 1
fi
app_path="$(cd "$(dirname "$app_path")" && pwd)/$(basename "$app_path")"
mkdir -p "$out_dir"
out_dir="$(cd "$out_dir" && pwd)"
candidates_file="$out_dir/dsym-candidates.txt"
if [[ -f "$app_path/Info.plist" ]]; then
executable="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$app_path/Info.plist")"
else
executable="$(basename "$app_path" .app)"
fi
app_binary="$app_path/$executable"
if [[ ! -f "$app_binary" ]]; then
echo "error: app executable not found: $app_binary" >&2
exit 1
fi
default_roots=(
"$(dirname "$app_path")"
"$PWD"
"$PWD/build"
"$PWD/bazel-bin"
"$PWD/bazel-out"
)
for root in "${default_roots[@]}"; do
if [[ -d "$root" ]]; then
search_roots+=("$root")
fi
done
if [[ -d "$HOME/Library/Developer/Xcode/DerivedData" ]]; then
search_roots+=("$HOME/Library/Developer/Xcode/DerivedData")
fi
: > "$candidates_file"
if [[ ${#search_roots[@]} -gt 0 ]]; then
find -L "${search_roots[@]}" -type d -name "*.dSYM" -prune -print 2>/dev/null >> "$candidates_file" || true
fi
if [[ ${#extra_dsyms[@]} -gt 0 ]]; then
for dsym in "${extra_dsyms[@]}"; do
if [[ -d "$dsym" ]]; then
printf '%s\n' "$dsym" >> "$candidates_file"
fi
done
fi
awk '!seen[$0]++' "$candidates_file" > "$candidates_file.tmp"
mv "$candidates_file.tmp" "$candidates_file"
if [[ ! -s "$candidates_file" ]]; then
echo "error: no dSYM candidates found. Add --search-root pointing at build output or DerivedData." >&2
exit 1
fi
contains_required_framework() {
local framework_name="$1"
if [[ ${#required_frameworks[@]} -eq 0 ]]; then
return 1
fi
for required in "${required_frameworks[@]}"; do
if [[ "$required" == "$framework_name" || "$required" == "${framework_name%.framework}" ]]; then
return 0
fi
done
return 1
}
copy_matching_dsym() {
local binary="$1"
local label="$2"
local required="$3"
if [[ ! -f "$binary" ]]; then
return 0
fi
local binary_uuids=()
while IFS= read -r uuid; do
[[ -n "$uuid" ]] && binary_uuids+=("$uuid")
done < <(dwarfdump --uuid "$binary" 2>/dev/null | awk '{ print $2 }')
if [[ ${#binary_uuids[@]} -eq 0 ]]; then
if [[ "$required" == "required" ]]; then
echo "error: could not read UUID for required $label: $binary" >&2
return 1
fi
echo "warning: could not read UUID for $label: $binary" >&2
return 0
fi
local match=""
local candidate_uuids=""
local has_all_uuids=""
while IFS= read -r candidate; do
candidate_uuids="$(dwarfdump --uuid "$candidate" 2>/dev/null | awk '{ print $2 }' || true)"
if [[ -z "$candidate_uuids" ]]; then
continue
fi
has_all_uuids=true
for uuid in "${binary_uuids[@]}"; do
if ! grep -Fxq "$uuid" <<< "$candidate_uuids"; then
has_all_uuids=false
break
fi
done
if [[ "$has_all_uuids" == "true" ]]; then
match="$candidate"
break
fi
done < "$candidates_file"
if [[ -z "$match" ]]; then
if [[ "$required" == "required" ]]; then
echo "error: missing required dSYM for $label UUIDs ${binary_uuids[*]}" >&2
return 1
fi
echo "warning: missing dSYM for $label UUIDs ${binary_uuids[*]}" >&2
return 0
fi
local dest="$out_dir/$(basename "$match")"
rm -rf "$dest"
cp -R "$match" "$dest"
printf 'matched %s UUIDs %s -> %s\n' "$label" "${binary_uuids[*]}" "$dest"
}
copy_matching_dsym "$app_binary" "$executable.app" required
if [[ -d "$app_path/Frameworks" ]]; then
for framework in "$app_path"/Frameworks/*.framework; do
[[ -d "$framework" ]] || continue
framework_name="$(basename "$framework")"
framework_binary="$framework/${framework_name%.framework}"
required="optional"
if [[ "$require_all_frameworks" == "true" ]] || contains_required_framework "$framework_name"; then
required="required"
fi
copy_matching_dsym "$framework_binary" "$framework_name" "$required"
done
fi
cat <<EOF
DSYMS=$out_dir
Use:
ettrace --simulator --launch --dsyms "$out_dir"
EOF
Related skills
FAQ
What does ios-ettrace-performance produce?
Preserved processed ETTrace output JSON, a summary.txt hotspot report, and flow-specific performance findings.
When should I use ios-ettrace-performance?
When profiling one iOS Simulator flow for launch or runtime latency with symbolicated ETTrace captures.
Is ios-ettrace-performance safe to install?
Review the Security Audits panel on this page before installing in production.