instruments-profiling
यह क्या करती है
यह स्किल दिखाती है कि नेटिव Apple ऐप का Time Profiler ट्रेस कैसे रिकॉर्ड किया जाए और उसे Instruments में कैसे खोला जाए। यह धीमे या भारी नेटिव ऐप्स की जाँच करने वाले डेवलपर्स के लिए है।
कब इस्तेमाल करें
- ✓जब कोई macOS या iOS ऐप धीमा है और आपको देखना है कि समय कहाँ जा रहा है।
- ✓जब आपको किसी खास ऐप बिल्ड का ट्रेस चाहिए, किसी दूसरी कॉपी का नहीं।
- ✓जब आप ऐप की परफ़ॉर्मेंस की कमांड लाइन रिकॉर्डिंग चाहते हैं।
Skill का लिंक
https://github.com/steipete/agent-scripts/blob/main/skills/instruments-profiling/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“जब मैं कोई प्रोजेक्ट खोलता हूँ तो मेरा Mac ऐप धीमा लगता है। परफ़ॉर्मेंस ट्रेस रिकॉर्ड कीजिए और दिखाइए कि समय कहाँ जा रहा है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट xctrace कमांड लाइन टूल से सही ऐप बाइनरी से जुड़कर ट्रेस रिकॉर्ड करता है, और नतीजे को स्टैक विश्लेषण के लिए Instruments में खोलता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Instruments Profiling (macOS/iOS)
Use this skill when the user wants performance profiling or stack analysis for native apps.
Focus: Time Profiler, xctrace CLI, and picking the correct binary/app instance.
Quick Start (CLI)
- List templates:
xcrun xctrace list templates - Record Time Profiler (launch):
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app
- Record Time Profiler (attach):
- Launch app yourself, get PID, then:
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach <pid>
- Open trace in Instruments:
open -a Instruments /tmp/App.trace
Note: xcrun xctrace --help is not a valid subcommand. Use xcrun xctrace help record.
Picking the Correct Binary (Critical)
Gotcha: Instruments may profile the wrong app (e.g., one in /Applications) if LaunchServices resolves a different bundle.
Use these rules:
- Prefer direct binary path for deterministic launch:
xcrun xctrace record ... --launch -- /path/App.app/Contents/MacOS/App
- If launching
.app, ensure it’s the intended bundle:open -n /path/App.app- Verify with
ps -p <pid> -o comm= -o command=
- If both
/Applications/App.appand a local build exist, explicitly target the local build path. - After launch, confirm the process path before trusting the trace.
Command Arguments (xctrace)
--template 'Time Profiler': template name fromxctrace list templates.--launch -- <cmd>: everything after--is the target command (binary or app bundle).--attach <pid|name>: attach to running process.--output <path>:.traceoutput. If omitted, file saved in CWD.--time-limit 60s|5m: set capture duration.--device <name|UDID>: required for iOS device runs.--target-stdout -: stream launched process stdout to terminal (useful for CLI tools).
Exporting Stacks (CLI)
- Inspect trace tables:
xcrun xctrace export --input /tmp/App.trace --toc
- Export raw time-profile samples:
xcrun xctrace export --input /tmp/App.trace --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output /tmp/time-profile.xml
- Post-process in a script (Python/Rust) to aggregate stacks.
Instruments UI Workflow
- Template: Time Profiler
- Use “Record” and capture the slow path (startup vs steady-state)
- Call Tree tips:
- Hide System Libraries
- Invert Call Tree
- Separate by Thread
- Focus on hot frames and call counts
Gotchas & Fixes
- Wrong app profiled: LaunchServices resolves installed app instead of local build.
- Fix: use direct binary path or
--attachwith known PID.
- Fix: use direct binary path or
- No samples / empty trace: App exits quickly or never hits work.
- Fix: longer capture, trigger workload during recording.
- Privacy prompts:
xctracemay need Developer Tools permission.- Fix: System Settings → Privacy & Security → Developer Tools → allow Terminal/Xcode.
- Large XML exports:
time-profileexports are huge.- Fix: filter with XPath and aggregate offline; don’t print to terminal.
iOS Specific Notes
- Device: use
xcrun xctrace list devicesand--device <UDID>. - Launch via Xcode if needed; attach with
xctrace --attach. - Ensure debug symbols for meaningful stacks.
Verification Checklist
- Confirm trace process path matches target build.
- Confirm stacks show expected app frames.
- Capture covers the slow operation (startup/refresh).
- Export stacks for automated diffing if optimizing.
अक्सर पूछे जाने वाले सवाल
गलत ऐप की प्रोफ़ाइल क्यों हो सकती है?
स्किल चेतावनी देती है कि macOS ऐप की कोई दूसरी कॉपी चुन सकता है, इसलिए वह सटीक बाइनरी पाथ को निशाना बनाने की सलाह देती है।
रिकॉर्डिंग कितनी देर चलती है?
उदाहरणों में समय-सीमा होती है, जैसे 60 सेकंड।
क्या यह पहले से चल रहे ऐप से जुड़ सकती है?
हाँ। स्किल ऐप लॉन्च होने के बाद प्रोसेस ID से जुड़ने का तरीका बताती है।
जानकारी
लेखक का मूल विवरण
Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.
repo: steipete/agent-scripts
लोकप्रियता
- GitHub स्टार
- 7.4k
- रैंकिंग में स्थान
- #13233
- लाइसेंस
- MIT
- अपडेट की गई
- 30/10/2026
कमेंट
- …
इस repository की और skills
beeper
7.4kआपके एजेंट को आपकी लोकल Beeper चैट हिस्ट्री में संदेश खोजने और यह पता करने में मदद करती है कि कोई अस्पष्ट संकेत किस चैट या संपर्क का है।
cloudflare-registrar
7.4kआपके एजेंट को Cloudflare Registrar पर डोमेन की कीमत और उपलब्धता जाँचने, और पुष्टि के बाद डोमेन रजिस्टर या सूचीबद्ध करने में मदद करती है।
codexbar
7.4kआपके एजेंट को Codex, Claude और Kimi जैसी AI सेवाओं पर आपका कितना उपयोग बचा है, यह जाँचने में मदद करती है, जिसमें सीमा, क्रेडिट और रीसेट का समय शामिल है।
create-cli
7.4kआपके एजेंट को कमांड लाइन टूल के कमांड, फ़्लैग, हेल्प टेक्स्ट, आउटपुट और एरर इस तरह डिज़ाइन करने में मदद करती है कि वह लोगों और स्क्रिप्ट दोनों के लिए काम करे।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।