Contents

MetricResult

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

Declaration

enum MetricResult

Mentioned in

Discussion

MetricResult unifies all metric types into a single enum. You receive MetricResult values by iterating the values array on a MetricReport.IntervalEntry, or the values array on a MetricReport.StateEntry.

for result in entry.values {
    switch result {
    case .cpuTime(let metric):
        process(metric)
    case .peakMemory(let metric):
        process(metric)
    case .hangTime(let metric):
        process(metric)
    @unknown default:
        break
    }
}

Use the metricGroup property to filter or categorize results without exhaustive switching when you only need a subset of metric types.

This type replaces the typed metric properties of MXMetricPayload, such as cpuMetrics, memoryMetrics, and networkTransferMetrics.

Topics

Metric group

Responsiveness and animation

App runtime

CPU and memory

Network

App launch

Storage

Display and GPU

See Also

Result types