मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग7.4k · #13233

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 पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/steipete/agent-scripts/blob/main/skills/instruments-profiling/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

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.app and 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 from xctrace list templates.
  • --launch -- <cmd>: everything after -- is the target command (binary or app bundle).
  • --attach <pid|name>: attach to running process.
  • --output <path>: .trace output. 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 --attach with known PID.
  • No samples / empty trace: App exits quickly or never hits work.
    • Fix: longer capture, trigger workload during recording.
  • Privacy prompts: xctrace may need Developer Tools permission.
    • Fix: System Settings → Privacy & Security → Developer Tools → allow Terminal/Xcode.
  • Large XML exports: time-profile exports are huge.
    • Fix: filter with XPath and aggregate offline; don’t print to terminal.

iOS Specific Notes

  • Device: use xcrun xctrace list devices and --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

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

beeper

7.4k

आपके एजेंट को आपकी लोकल Beeper चैट हिस्ट्री में संदेश खोजने और यह पता करने में मदद करती है कि कोई अस्पष्ट संकेत किस चैट या संपर्क का है।

डेटाडेटाबेस

cloudflare-registrar

7.4k

आपके एजेंट को Cloudflare Registrar पर डोमेन की कीमत और उपलब्धता जाँचने, और पुष्टि के बाद डोमेन रजिस्टर या सूचीबद्ध करने में मदद करती है।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

codexbar

7.4k

आपके एजेंट को Codex, Claude और Kimi जैसी AI सेवाओं पर आपका कितना उपयोग बचा है, यह जाँचने में मदद करती है, जिसमें सीमा, क्रेडिट और रीसेट का समय शामिल है।

AI और एजेंटएजेंट

create-cli

7.4k

आपके एजेंट को कमांड लाइन टूल के कमांड, फ़्लैग, हेल्प टेक्स्ट, आउटपुट और एरर इस तरह डिज़ाइन करने में मदद करती है कि वह लोगों और स्क्रिप्ट दोनों के लिए काम करे।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills