---
title: XCTMetric
framework: xctest
role: symbol
role_heading: Protocol
path: xctest/xctmetric
---

# XCTMetric

A protocol that defines the methods that objects must provide when gathering metrics during performance tests.

## Declaration

```swift
protocol XCTMetric : NSCopying, NSObjectProtocol
```

## Overview

Overview Objects that gather metrics during performance tests must conform to XCTMetric. Before you create your own conforming objects, first use the metrics classes that XCTest supplies.

## Topics

### Recording Metrics

- [willBeginMeasuring()](xctest/xctmetric/willbeginmeasuring().md)
- [didStopMeasuring()](xctest/xctmetric/didstopmeasuring().md)

### Reporting Gathered Metrics

- [reportMeasurements(from:to:)](xctest/xctmetric/reportmeasurements(from:to:).md)

## Relationships

### Inherits From

- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Conforming Types

- [XCTApplicationLaunchMetric](xctest/xctapplicationlaunchmetric.md)
- [XCTCPUMetric](xctest/xctcpumetric.md)
- [XCTClockMetric](xctest/xctclockmetric.md)
- [XCTHitchMetric](xctest/xcthitchmetric.md)
- [XCTMemoryMetric](xctest/xctmemorymetric.md)
- [XCTOSSignpostMetric](xctest/xctossignpostmetric.md)
- [XCTStorageMetric](xctest/xctstoragemetric.md)

## See Also

### Measurement Metrics

- [XCTCPUMetric](xctest/xctcpumetric.md)
- [XCTClockMetric](xctest/xctclockmetric.md)
- [XCTHitchMetric](xctest/xcthitchmetric.md)
- [XCTMemoryMetric](xctest/xctmemorymetric.md)
- [XCTOSSignpostMetric](xctest/xctossignpostmetric.md)
- [XCTStorageMetric](xctest/xctstoragemetric.md)
- [XCTApplicationLaunchMetric](xctest/xctapplicationlaunchmetric.md)
