本文へスキップ
Skillpedia
一般的なプログラミング7.4k · #13237

native-app-performance

できること

このスキルは、Apple のコマンドラインツールで Time Profiler のトレースを記録し、Instruments を開かずに、負荷の高い箇所をランク付けします。ネイティブアプリの遅い動きを追う開発者向けです。

使う場面

  • ✓ネイティブの Mac や iOS のアプリが遅く、負荷の高いコードを見つけたいとき。
  • ✓アプリの中ではなく、コマンドラインからプロファイルを記録したいとき。
  • ✓トレースのスタックが空になり、遅い操作をもう一度取り直す必要があるとき。

スキルのリンク

https://github.com/steipete/agent-scripts/blob/main/skills/native-app-performance/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/steipete/agent-scripts/blob/main/skills/native-app-performance/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“遅い操作をしながら、アプリの90秒のパフォーマンス・トレースを記録して、負荷の高い箇所の一覧を出してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは xctrace ツールでトレースを記録し、時間のサンプルを取り出し、読み込みアドレスを探します。同梱のスクリプトで、負荷の高い関数をランク付けします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Native App Performance (CLI-only)

Goal: record Time Profiler via xctrace, extract samples, symbolicate, and propose hotspots without opening Instruments.

Quick start (CLI)

  1. Record Time Profiler (attach):
# Start app yourself, then attach
xcrun xctrace record --template 'Time Profiler' --time-limit 90s --output /tmp/App.trace --attach <pid>
  1. Record Time Profiler (launch):
xcrun xctrace record --template 'Time Profiler' --time-limit 90s --output /tmp/App.trace --launch -- /path/App.app/Contents/MacOS/App
  1. Extract time samples:
scripts/extract_time_samples.py --trace /tmp/App.trace --output /tmp/time-sample.xml
  1. Get load address for symbolication:
# While app is running
vmmap <pid> | rg -m1 "__TEXT" -n
  1. Symbolicate + rank hotspots:
scripts/top_hotspots.py --samples /tmp/time-sample.xml \
  --binary /path/App.app/Contents/MacOS/App \
  --load-address 0x100000000 --top 30

Workflow notes

  • Always confirm you’re profiling the correct binary (local build vs /Applications). Prefer direct binary path for --launch.
  • Ensure you trigger the slow path during capture (menu open/close, refresh, etc.).
  • If stacks are empty, capture longer or avoid idle sections.
  • xcrun xctrace help record and xcrun xctrace help export show correct flags.

Included scripts

  • scripts/record_time_profiler.sh: record via attach or launch.
  • scripts/extract_time_samples.py: export time-sample XML from a trace.
  • scripts/top_hotspots.py: symbolicate and rank top app frames.

Gotchas

  • ASLR means you must use the runtime __TEXT load address from vmmap.
  • If using a new build, update the --binary path; symbols must match the trace.
  • CLI-only flow: no need to open Instruments if stacks are symbolicated via atos.
よくある質問

Instruments を開く必要がありますか?

いいえ。スキルは Instruments を開かずに、コマンドラインからプロファイリングを行います。

トレースが間違っている可能性はありますか?

あります。間違ったコピーのアプリを計測するおそれがあるため、正確なバイナリのパスを指定するよう、スキルは警告しています。

スタックが空の場合はどうしますか?

より長く記録するか、待機中の部分を避けるよう、スキルは述べています。

詳細

作者による元の説明

Native app performance: xctrace, Time Profiler, traces, hotspots.

repo: steipete/agent-scripts

人気

GitHubのスター
7.4k
ランキング
#13237
ライセンス
MIT
更新日
2026/10/30

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル