everettjf/AppleTrace
Free🍎Objective C Method Tracing Call Chart
About everettjf/AppleTrace
AppleTrace is a lightweight, embeddable Objective-C tracing toolkit for iOS and macOS apps. It captures execution timelines by either automatically hooking every objc_msgSend (via arm64 function rebinding) or via manually placed APTBeginSection/APTEndSection markers. The recorded trace fragments are merged using a Python CLI tool into a single trace.json file, which can be opened in Perfetto (ui.perfetto.dev) for detailed visualization of method call durations, thread names, counters, and async events. Designed for performance, it uses name interning, zero-allocation per-thread call stacks, and batched writing to minimize overhead. AppleTrace is open source (MIT license) and maintained on an as-needed basis.
Key Features
Pros & Cons
- Low overhead tracing due to zero-allocation design and batched writes
- Works on real iOS/macOS devices without requiring jailbreak
- Produces standard trace.json viewable in Perfetto, a powerful open-source trace visualizer
- Supports both automatic (no code changes) and manual tracing approaches
- Rich event types including counters, async, and flow events for complex scenarios
- Open source (MIT license) with clear documentation and tutorial
- Automatic method tracing currently limited to arm64 architectures (iOS/macOS devices)
- Requires Python 3 tooling for merging trace fragments, adding a processing step
- Manual section markers must be added to source code, which may not be suitable for all projects
- Maintained as needed, so updates may be infrequent
- Only supports Objective-C (not Swift method tracing directly, though Swift can call ObjC methods)