Community연구 & 데이터 분석github.com

steipete/instruments-profiling

Instruments/xctrace 프로파일링: macOS/iOS 트레이스, 바이너리, 인수, 내보내기.

instruments-profiling란 무엇인가요?

이 스킬은 네이티브 앱의 성능 프로파일링 및 스택 분석을 위해 Instruments와 xctrace CLI를 활용하는 방법을 제공합니다. macOS 및 iOS 앱의 Time Profiler 템플릿을 사용하여 CPU 사용량과 호출 스택을 캡처하고, 잘못된 앱 인스턴스를 프로파일링하는 문제를 방지하기 위해 올바른 바이너리 경로를 선택하는 방법을 중점적으로 다룹니다. xcrun xctrace 명령어를 사용한 트레이스 기록, 첨부, 내보내기 방법과 함께 Instruments UI에서의 워크플로우, 일반적인 문제 상황과 해결책을 안내합니다. 또한 iOS 기기 프로파일링을 위한 추가 설정 및 대규모 XML 데이터 처리 방법을 포함하여 개발자와 AI 에이전트가 정확한 성능 분석을 수행할 수 있도록 지원합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/instruments-profiling

Installed? Explore more 연구 & 데이터 분석 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Instruments 프로파일링 (macOS/iOS)

이 스킬은 네이티브 앱의 성능 프로파일링 또는 스택 분석이 필요할 때 사용합니다. 초점: Time Profiler, xctrace CLI, 올바른 Binary/App 인스턴스 선택.

빠른 시작 (CLI)

  • 템플릿 목록 보기: xcrun xctrace list templates
  • Time Profiler 기록 (실행):
    • xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app
  • Time Profiler 기록 (연결):
    • 앱을 직접 실행하고 PID를 얻은 후:
    • xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach <pid>
  • Instruments에서 트레이스 열기:
    • open -a Instruments /tmp/App.trace

참고: xcrun xctrace --help는 유효한 하위 명령어가 아닙니다. xcrun xctrace help record를 사용하세요.

올바른 Binary 선택 (중요)

주의: Instruments가 잘못된 앱을 프로파일링할 수 있음 (예: LaunchServices가 다른 번들을 확인하여 /Applications에 있는 앱). 다음 규칙을 따르세요:

  • 결정적 실행을 위해 직접 바이너리 경로 선호:
    • xcrun xctrace record ... --launch -- /path/App.app/Contents/MacOS/App
  • .app을 실행하는 경우 의도한 번들인지 확인:
    • open -n /path/App.app
    • ps -p <pid> -o comm= -o command=로 확인
  • /Applications/App.app과 로컬 빌드가 모두 존재하는 경우 로컬 빌드 경로를 명시적으로 대상으로 지정하세요.
  • 실행 후, 트레이스를 신뢰하기 전에 프로세스 경로를 확인하세요.

명령어 인수 (xctrace)

  • --template 'Time Profiler': xctrace list templates의 템플릿 이름.
  • --launch -- <cmd>: -- 뒤에 오는 모든 것은 대상 명령어 (바이너리 또는 앱 번들).
  • --attach <pid|name>: 실행 중인 프로세스에 연결.
  • --output <path>: .trace 출력. 생략하면 CWD에 파일 저장.
  • --time-limit 60s|5m: 캡처 기간 설정.
  • --device <name|UDID>: iOS 기기 실행 시 필요.
  • --target-stdout -: 실행된 프로세스의 stdout을 터미널로 스트리밍 (CLI 도구에 유용).

스택 내보내기 (CLI)

  • 트레이스 테이블 검사:
    • xcrun xctrace export --input /tmp/App.trace --toc
  • 원시 타임-프로파일 샘플 내보내기:
    • xcrun xctrace export --input /tmp/App.trace --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output /tmp/time-profile.xml
  • 스크립트(Python/Rust)에서 후처리하여 스택 집계.

Instruments UI 워크플로우

  • 템플릿: Time Profiler
  • "Record"를 사용하여 느린 경로 캡처 (시작 vs 정상 상태)
  • Call Tree 팁:
    • 시스템 라이브러리 숨기기
    • 호출 트리 반전
    • 스레드별 분리
    • 핫 프레임과 호출 횟수에 집중

문제점 및 해결책

  • 잘못된 앱 프로파일링: LaunchServices가 로컬 빌드 대신 설치된 앱을 확인함.
    • 해결: 직접 바이너리 경로를 사용하거나 알려진 PID로 --attach를 사용하세요.
  • 샘플 없음 / 빈 트레이스: 앱이 빨리 종료되거나 작업을 실행하지 않음.
    • 해결: 더 긴 캡처, 기록 중 워크로드 트리거.
  • 개인정보 보호 프롬프트: xctrace에 개발자 도구 권한이 필요할 수 있음.
    • 해결: 시스템 설정 → 개인정보 보호 및 보안 → 개발자 도구 → 터미널/Xcode 허용.
  • 대규모 XML 내보내기: time-profile 내보내기가 매우 큼.
    • 해결: XPath로 필터링하고 오프라인에서 집계하며, 터미널에 출력하지 마세요.

iOS 관련 참고 사항

  • 기기: xcrun xctrace list devices 및 --device <UDID> 사용.
  • 필요시 Xcode를 통해 실행하고 xctrace --attach로 연결하세요.
  • 의미 있는 스택을 위해 디버그 심볼이 있는지 확인하세요.

확인 체크리스트

  • 트레이스 프로세스 경로가 대상 빌드와 일치하는지 확인.
  • 스택에 예상되는 앱 프레임이 표시되는지 확인.
  • 캡처가 느린 작업 (시작/갱신)을 포함하는지 확인.
  • 최적화 시 자동화된 차이 분석을 위해 스택을 내보내세요.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

steipete/agent-transcript

GitHub PR/issue agent transcripts: redact, preview, and insert safely.

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/create-cli

CLI UX/spec: args, flags, help, output, errors, config, dry-run.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-cache-hygiene

GitHub quota/cache hygiene: gh, ghx, xcache, gitcrawl, mirrors, limits.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

steipete/nano-banana-pro

Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.

관련 스킬