<!--
{
  "availability" : [
    "iOS: 13.0 -",
    "iPadOS: 13.0 -",
    "macCatalyst: 13.0 -",
    "macOS: 12.0 -",
    "visionOS: 1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetricKit",
  "identifier" : "/documentation/MetricKit",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "MetricKit"
    ],
    "preciseIdentifier" : "MetricKit"
  },
  "title" : "MetricKit"
}
-->

# MetricKit

Measure your app’s performance using daily metric and diagnostic reports from real users.

## Overview

MetricKit provides on-device app diagnostics and power and performance metrics the system captures. The system delivers metric reports about the previous 24 hours to your app at most once per day. Diagnostic reports arrive immediately in iOS 15 and later, and macOS 12 and later. For apps running in visionOS, the framework supports diagnostics for crashes, hangs, high energy use, and disk writes, but doesn’t report performance metrics. This applies to apps built for visionOS and compatible iPhone and iPad apps running in visionOS.

Use this data to improve the performance of your iOS app, macOS app, or Mac Catalyst app.

In iOS 27 and later and macOS 27 and later, [`MetricManager`](/documentation/MetricKit/MetricManager) delivers [`MetricReport`](/documentation/MetricKit/MetricReport) and [`DiagnosticReport`](/documentation/MetricKit/DiagnosticReport) values through asynchronous sequences. On visionOS 27 and later, [`MetricManager`](/documentation/MetricKit/MetricManager) delivers diagnostic reports only. MetricKit also supports tracking state-based metrics using the <doc://com.apple.documentation/documentation/StateReporting> framework.

## Topics

### Essentials

[Monitoring app performance with MetricKit](/documentation/MetricKit/monitoring-app-performance-with-metrickit)

Receive daily performance metrics and immediate diagnostic reports from real device usage.

[Analyzing app performance with MetricKit](/documentation/MetricKit/analyzing-app-performance-with-metrickit)

Work with the metric values, diagnostic data, and environments in MetricKit reports.

[Track performance by app state using MetricKit](/documentation/MetricKit/track-performance-by-app-state-using-metrickit)

Collect performance metrics, diagnostic reports, and experiment data related to your app’s current state using the MetricKit framework.

  <doc://com.apple.documentation/documentation/Updates/MetricKit>

### Performance improvements

  <doc://com.apple.documentation/documentation/Xcode/improving-your-app-s-performance>

### Metric and diagnostic reports

[`class MetricManager`](/documentation/MetricKit/MetricManager)

An object that delivers metric and diagnostic reports to your app.

[`struct MetricReport`](/documentation/MetricKit/MetricReport)

A daily performance report that contains metric values for your app.

[`struct DiagnosticReport`](/documentation/MetricKit/DiagnosticReport)

A report describing a single diagnostic event.

### Result types

[`enum MetricResult`](/documentation/MetricKit/MetricResult)

An enumeration that represents a single metric value from a metric report entry.

[`struct MetricGroup`](/documentation/MetricKit/MetricGroup)

A value that identifies the category a metric belongs to.

[`enum DiagnosticResult`](/documentation/MetricKit/DiagnosticResult)

An enumeration that represents a single diagnostic event from a diagnostic report.

### Time-in-use metrics

[`struct TotalForegroundTimeMetric`](/documentation/MetricKit/TotalForegroundTimeMetric)

A metric that measures the total time the app spent in the foreground.

[`struct TotalBackgroundTimeMetric`](/documentation/MetricKit/TotalBackgroundTimeMetric)

A metric that measures the total time the app spent active in the background.

[`struct TotalBackgroundAudioTimeMetric`](/documentation/MetricKit/TotalBackgroundAudioTimeMetric)

A metric that measures the total time the app spent in the background playing audio.

[`struct TotalBackgroundLocationTimeMetric`](/documentation/MetricKit/TotalBackgroundLocationTimeMetric)

A metric that measures the total time the app spent in the background using location services.

[`struct LocationActivityTimeMetric`](/documentation/MetricKit/LocationActivityTimeMetric)

A metric that measures time spent using location services at each accuracy level.

[`struct CellularConditionTimeMetric`](/documentation/MetricKit/CellularConditionTimeMetric)

A metric that measures time spent at each cellular signal strength.

### Launch and responsiveness metrics

[`struct TimeToFirstDrawMetric`](/documentation/MetricKit/TimeToFirstDrawMetric)

A metric that measures time to first draw durations for app launches.

[`struct OptimizedTimeToFirstDrawMetric`](/documentation/MetricKit/OptimizedTimeToFirstDrawMetric)

A metric that measures optimized time to first draw durations for app launches.

[`struct ApplicationResumeTimeMetric`](/documentation/MetricKit/ApplicationResumeTimeMetric)

A metric that measures app resume time durations.

[`struct ExtendedLaunchMetric`](/documentation/MetricKit/ExtendedLaunchMetric)

A metric that measures extended launch task durations.

[`struct HangTimeMetric`](/documentation/MetricKit/HangTimeMetric)

A metric that measures app hang time.

[`struct HitchTimeMetric`](/documentation/MetricKit/HitchTimeMetric)

A metric that measures animation hitch time.

### CPU and memory metrics

[`struct CPUTimeMetric`](/documentation/MetricKit/CPUTimeMetric)

A metric that measures the total CPU time used by the app.

[`struct CPUInstructionsCountMetric`](/documentation/MetricKit/CPUInstructionsCountMetric)

A metric that measures the total number of CPU instructions the app executed.

[`struct CPUExceptionDiagnostic`](/documentation/MetricKit/CPUExceptionDiagnostic)

A diagnostic for a fatal or nonfatal CPU exception.

[`struct PeakMemoryMetric`](/documentation/MetricKit/PeakMemoryMetric)

A metric that measures peak memory footprint.

[`struct SuspendedMemoryMetric`](/documentation/MetricKit/SuspendedMemoryMetric)

A metric that measures average suspended memory footprint with statistical data.

[`struct MemoryExceptionDiagnostic`](/documentation/MetricKit/MemoryExceptionDiagnostic)

A diagnostic MetricKit generates when your app or extension terminates because it exceeds the memory limit.

### GPU and display metrics

[`struct GPUTimeMetric`](/documentation/MetricKit/GPUTimeMetric)

A metric that measures the total GPU time used by the app.

[`struct MetalFrameRateMetric`](/documentation/MetricKit/MetalFrameRateMetric)

A metric that measures Metal frame rate statistics for a specific `CAMetalLayer`.

[`struct PixelLuminanceMetric`](/documentation/MetricKit/PixelLuminanceMetric)

A metric that measures the average luminosity of pixels on an OLED display.

[`class AveragePixelLuminance`](/documentation/MetricKit/AveragePixelLuminance)

A unit for average pixel luminance measurements.

### Network metrics

[`struct TotalWiFiUploadMetric`](/documentation/MetricKit/TotalWiFiUploadMetric)

A metric that measures the total data uploaded over WiFi.

[`struct TotalWiFiDownloadMetric`](/documentation/MetricKit/TotalWiFiDownloadMetric)

A metric that measures the total data downloaded over WiFi.

[`struct TotalCellularUploadMetric`](/documentation/MetricKit/TotalCellularUploadMetric)

A metric that measures the total data uploaded over a cellular connection.

[`struct TotalCellularDownloadMetric`](/documentation/MetricKit/TotalCellularDownloadMetric)

A metric that measures the total data downloaded over a cellular connection.

### Disk metrics

[`struct LogicalDiskWritesMetric`](/documentation/MetricKit/LogicalDiskWritesMetric)

A metric that measures the total data written to disk.

[`struct DiskWriteExceptionDiagnostic`](/documentation/MetricKit/DiskWriteExceptionDiagnostic)

A diagnostic for a disk write exception.

[`struct TotalDiskSpaceCapacityMetric`](/documentation/MetricKit/TotalDiskSpaceCapacityMetric)

A metric that measures disk capacity and usage on the device.

[`struct TotalFileCountMetric`](/documentation/MetricKit/TotalFileCountMetric)

A metric that measures the number of files attributed to the app.

[`struct TotalFileSizeMetric`](/documentation/MetricKit/TotalFileSizeMetric)

A metric that measures the sizes of files attributed to the app.

### Termination metrics

[`struct ForegroundTerminationMetric`](/documentation/MetricKit/ForegroundTerminationMetric)

A metric that counts app terminations from the foreground by category.

[`struct BackgroundTerminationMetric`](/documentation/MetricKit/BackgroundTerminationMetric)

A metric that counts app terminations from the background by category.

### Signpost and custom metrics

[`struct SignpostIntervalMetric`](/documentation/MetricKit/SignpostIntervalMetric)

A metric that measures the duration and count of custom signpost intervals.

[`func mxSignpost(OSSignpostType, dso: UnsafeRawPointer, log: OSLog, name: StaticString, signpostID: OSSignpostID, StaticString, [any CVarArg])`](/documentation/MetricKit/mxSignpost(_:dso:log:name:signpostID:_:_:))

Posts a single custom metric, the start time of a custom metric, or the end time of a custom metric to the log system.

[`func mxSignpostAnimationIntervalBegin(dso: UnsafeRawPointer, log: OSLog, name: StaticString, signpostID: OSSignpostID, StaticString, [any CVarArg])`](/documentation/MetricKit/mxSignpostAnimationIntervalBegin(dso:log:name:signpostID:_:_:))

Posts the start time of an animation interval to the log system.

### Crash and hang diagnostics

[`struct CrashDiagnostic`](/documentation/MetricKit/CrashDiagnostic)

A diagnostic report that describes a crash that occurred.

[`struct HangDiagnostic`](/documentation/MetricKit/HangDiagnostic)

A diagnostic for an app that was too busy to handle user input responsively.

[`struct AppLaunchDiagnostic`](/documentation/MetricKit/AppLaunchDiagnostic)

A diagnostic report for an app launch.

### App state reporting

[`struct StateReportingDomain`](/documentation/MetricKit/StateReportingDomain)

A value that identifies a reporting scope for segmenting metric data.

[`struct LaunchTaskID`](/documentation/MetricKit/LaunchTaskID)

An identifier for a task measured as part of an extended app launch.

### Call stack data

[`struct CallStackTree`](/documentation/MetricKit/CallStackTree)

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

[`struct CallStackThread`](/documentation/MetricKit/CallStackThread)

A single stack thread within a call stack tree.

[`struct CallStackFrame`](/documentation/MetricKit/CallStackFrame)

A single frame within a call stack thread.

[`struct SignpostRecord`](/documentation/MetricKit/SignpostRecord)

A record of a signpost event associated with a diagnostic report.

### Supporting types

[`struct Histogram`](/documentation/MetricKit/Histogram)

A distribution of values organized into buckets.

[`struct AverageStatistics`](/documentation/MetricKit/AverageStatistics)

A value that encapsulates an average measurement with supporting statistical data.

[`class SignalBars`](/documentation/MetricKit/SignalBars)

A unit for cellular signal strength measurements in bars.

[`class HitchTimeRatio`](/documentation/MetricKit/HitchTimeRatio)

A unit for animation hitch time ratio measurements.

[`struct OSVersion`](/documentation/MetricKit/OSVersion)

The version of the operating system on the device.

### MXMetricManager API

[MXMetricManager API](/documentation/MetricKit/MXMetricManager-API)

Measure app performance and diagnostics using MXMetricManager and related types.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)