MetricKit collects on-device performance and power metrics along with diagnostic reports for your app on iOS, macOS, tvOS, and visionOS. Register an MXMetricManagerSubscriber with the MXMetricManager to receive MXMetricPayload and MXDiagnosticPayload objects covering metrics such as MXCPUMetric, MXMemoryMetric, MXDiskIOMetric, MXAppLaunchMetric, and MXAppResponsivenessMetric. Diagnostics including MXCrashDiagnostic, MXHangDiagnostic, MXCPUExceptionDiagnostic, and MXDiskWriteExceptionDiagnostic carry an MXCallStackTree so you can locate the source of a problem. Aggregated values arrive through supporting types like MXHistogram, MXAverage, and unit classes such as MXUnitSignalBars and MXUnitAveragePixelLuminance.
Essentials 5
The manager and subscriber interface you use to register for and receive on-device metric and diagnostic reports.
- ClMXMetricManager@class MXMetricManager
- PrMXMetricManagerSubscriber@protocol MXMetricManagerSubscriber
- ClMetricManagerA type that manages registration for and delivery of on-device metric and diagnostic reports.
- ClMXMetric@class MXMetric
- StMXErrorA type that describes errors encountered while collecting or delivering MetricKit data.
Payloads 8
The container objects that deliver a batch of aggregated metrics or diagnostics for a reporting period.
- ClMXMetricPayload@class MXMetricPayload
- ClMXDiagnosticPayload@class MXDiagnosticPayload
- ClMXMetaData@class MXMetaData
- StMetricReportA report containing metric data entries collected during the reporting period.
- StDiagnosticReportA report containing a diagnostic event.
- StMetricGroupCategorization system for metrics.
- EnMetricResultEnum representing all possible metric types that can be returned.
- EnDiagnosticResultEnum representing different diagnostic types.
CPU and GPU Metrics 5
Metrics that report processor and graphics workload consumed by your app.
- ClMXCPUMetric@class MXCPUMetric
- ClMXGPUMetric@class MXGPUMetric
- StCPUTimeMetricA metric for CPU time.
- StCPUInstructionsCountMetricA metric for CPU instructions.
- StGPUTimeMetricA metric for GPU time.
Memory Metrics 3
Metrics that report your app's memory footprint and peak usage.
- ClMXMemoryMetric@class MXMemoryMetric
- StPeakMemoryMetricA metric for peak memory.
- StSuspendedMemoryMetricA metric for suspended memory.
Disk and Storage Metrics 6
Metrics that report disk I/O, logical writes, and storage capacity and usage.
- ClMXDiskIOMetric@class MXDiskIOMetric
- ClMXDiskSpaceUsageMetric@class MXDiskSpaceUsageMetric
- StLogicalDiskWritesMetricA metric for disk writes.
- StTotalDiskSpaceCapacityMetricA metric for disk space capacity.
- StTotalFileCountMetricA metric for total file counts.
- StTotalFileSizeMetricA metric for total file sizes.
Network Metrics 7
Metrics that report cellular and Wi-Fi data transfer and cellular signal conditions.
- ClMXNetworkTransferMetric@class MXNetworkTransferMetric
- ClMXCellularConditionMetric@class MXCellConditionMetric
- StCellularConditionTimeMetricA metric for cellular condition time.
- StTotalCellularDownloadMetricA metric for total cellular download.
- StTotalCellularUploadMetricA metric for total cellular upload.
- StTotalWiFiDownloadMetricA metric for total WiFi download.
- StTotalWiFiUploadMetricA metric for total WiFi upload.
Launch and Responsiveness Metrics 9
Metrics that report app launch time, resume time, and time-to-first-draw responsiveness.
- ClMXAppLaunchMetric@class MXAppLaunchMetric
- ClMXAppResponsivenessMetric@class MXAppResponsivenessMetric
- StExtendedLaunchMetricA metric for extended launch.
- StApplicationResumeTimeMetricA metric for application resume time.
- StTimeToFirstDrawMetricA metric for time to first draw.
- StOptimizedTimeToFirstDrawMetricA metric for optimized time to first draw.
- StHangTimeMetricA metric for app hang time.
- StMXLaunchTaskID@typedef MXLaunchTaskID
- StLaunchTaskIDThe task identifier to track launch measurements.
Display and Animation Metrics 6
Metrics that report display luminance, scroll hitches, and Metal animation frame rate.
- ClMXDisplayMetric@class MXDisplayMetric
- ClMXAnimationMetric@class MXAnimationMetric
- StPixelLuminanceMetricA metric for pixel luminance.
- StHitchTimeMetricA metric for hitch time.
- StScrollHitchTimeMetricA metric for scroll hitch time.
- StMetalFrameRateMetricA metric for Metal frame rate.
Runtime and Exit Metrics 10
Metrics that report app run time, foreground and background time, and how the app exited.
- ClMXAppRunTimeMetric@class MXAppRunTimeMetric
- ClMXAppExitMetric@class MXAppExitMetric
- ClMXForegroundExitData@class MXForegroundExitData
- ClMXBackgroundExitData@class MXBackgroundExitData
- StTotalForegroundTimeMetricA metric for total foreground time.
- StTotalBackgroundTimeMetricA metric for total background time.
- StTotalBackgroundAudioTimeMetricA metric for total background audio time.
- StTotalBackgroundLocationTimeMetricA metric for total background location time.
- StForegroundTerminationMetricA metric for foreground app terminations.
- StBackgroundTerminationMetricA metric for background app terminations.
Location Metrics 2
Metrics that report location service activity attributed to your app.
- ClMXLocationActivityMetric@class MXLocationActivityMetric
- StLocationActivityTimeMetricA metric for location activity times.
Signpost Metrics 5
Metrics that report custom performance signposts your app emits.
- ClMXSignpostMetric@class MXSignpostMetric
- ClMXSignpostIntervalData@class MXSignpostIntervalData
- ClMXSignpostRecord@class MXSignpostRecord
- StSignpostIntervalMetricA metric for signpost intervals.
- StSignpostRecordSignpost record for diagnostics
Diagnostics 13
Diagnostic reports that capture crashes, hangs, and resource exceptions with their causes.
- ClMXDiagnostic@class MXDiagnostic
- ClMXCrashDiagnostic@class MXCrashDiagnostic
- ClMXCrashDiagnosticObjectiveCExceptionReason@class MXCrashDiagnosticObjectiveCExceptionReason
- ClMXHangDiagnostic@class MXHangDiagnostic
- ClMXAppLaunchDiagnostic@class MXAppLaunchDiagnostic
- ClMXCPUExceptionDiagnostic@class MXCPUExceptionDiagnostic
- ClMXDiskWriteExceptionDiagnostic@class MXDiskWriteExceptionDiagnostic
- StCrashDiagnosticA diagnostic that encapsulates crash reports.
- StHangDiagnosticA diagnostic for an app that is too busy to handle user input responsively.
- StAppLaunchDiagnosticA diagnostic for app launch.
- StCPUExceptionDiagnosticA diagnostic for a fatal or nonfatal CPU exception.
- StDiskWriteExceptionDiagnosticA diagnostic for a disk write exception.
- StMemoryExceptionDiagnosticA diagnostic for a fatal memory exception.
Call Stacks 4
Types that represent the call stack tree captured with a diagnostic so you can locate the source of a problem.
- ClMXCallStackTree@class MXCallStackTree
- StCallStackTreeCall stack tree structure
- StCallStackThreadIndividual call stack thread within a call stack tree
- StCallStackFrameIndividual call stack frame
Aggregation and Statistics 5
Supporting types that summarize metric data as histograms and averages.
- ClMXHistogram@class MXHistogram
- ClMXHistogramBucket@class MXHistogramBucket
- ClMXAverage@class MXAverage
- StHistogramA histogram of values.
- StAverageStatisticsA struct that encapsulates an average value with statistical data.
Units and Supporting Values 4
Measurement units and value types used to describe metric data and reporting context.
- ClMXUnitSignalBars@class MXUnitSignalBars
- ClMXUnitAveragePixelLuminance@class MXUnitAveragePixelLuminance
- StOSVersionThe version of the operating system on the device.
- StStateReportingDomainThe reverse-DNS notation StateReporting domain
Classes 2
- ClAveragePixelLuminanceUnit for average pixel luminance measurements
- ClSignalBarsUnit for cellular signal strength measurements