<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTClockMetric",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTClockMetric"
  },
  "title" : "XCTClockMetric"
}
-->

# XCTClockMetric

A metric to record the time that elapses during a performance test.

```
class XCTClockMetric
```

## Overview

`XCTClockMetric` measures the total elapsed time during execution of the block argument to [`measure(metrics:block:)`](/documentation/XCTest/XCTestCase/measure(metrics:block:)). The metric records time monotonically, regardless of changes to the system clock. Its result includes time spent executing code under test, and time when the CPU is idle or running other code.

## Topics

### Initializing an Item

[`init()`](/documentation/XCTest/XCTClockMetric/init())

Initializes a metric that records elapsed time in a performance test.



---

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)