---
title: CallStackTree
framework: metrickit
role: symbol
role_heading: Structure
path: metrickit/callstacktree
---

# CallStackTree

A tree structure representing a collection of call stacks captured during a diagnostic event.

## Declaration

```swift
struct CallStackTree
```

## Mentioned in

Analyzing app performance with MetricKit

## Discussion

Discussion Each diagnostic struct — including CrashDiagnostic, HangDiagnostic, CPUExceptionDiagnostic, DiskWriteExceptionDiagnostic, AppLaunchDiagnostic, and MemoryExceptionDiagnostic — carries a callStackTree property of this type. The tree is organized into threads via callStackThreads. Each CallStackThread contains root CallStackFrame values that form a tree of sub-frames. Binary metadata is deduplicated in binaryInfo, keyed by UUID, so frames reference binaries by UUID rather than repeating the name. Use forEachFrame(_:) for an optimized iterative depth-first traversal of all frames across all threads: callStackTree.forEachFrame { frame in     if let name = frame.binaryName(from: callStackTree) {         print(name, frame.offsetIntoBinaryTextSegment ?? 0)     } } This type replaces MXCallStackTree.

## Topics

### Threads and frames

- [callStackThreads](metrickit/callstacktree/callstackthreads.md)
- [callStackPerThread](metrickit/callstacktree/callstackperthread.md)
- [forEachFrame(_:)](metrickit/callstacktree/foreachframe(_:).md)

### Binary information

- [binaryInfo](metrickit/callstacktree/binaryinfo-swift.property.md)

### Related types

- [CallStackThread](metrickit/callstackthread.md)
- [CallStackFrame](metrickit/callstackframe.md)

### Structures

- [CallStackTree.BinaryInfo](metrickit/callstacktree/binaryinfo-swift.struct.md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Call stack data

- [CallStackThread](metrickit/callstackthread.md)
- [CallStackFrame](metrickit/callstackframe.md)
- [SignpostRecord](metrickit/signpostrecord.md)
