---
title: "init(limitingToCurrentThread:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctcpumetric/init(limitingtocurrentthread:)"
---

# init(limitingToCurrentThread:)

Creates a CPU metric that optionally records data only for the current thread.

## Declaration

```swift
init(limitingToCurrentThread limitToCurrentThread: Bool)
```

## Parameters

- `limitToCurrentThread`: A Boolean value that specifies whether to limit the recording of data for this metric to the current thread only.

## Discussion

Discussion If limitToCurrentThread is true, the returned metric only records data related to CPU use on the current thread. In a single-threaded context, a thread-limited metric provides lower variance and greater precision than a whole-process metric.

## See Also

### Initializers

- [init()](xctest/xctcpumetric/init().md)
- [init(application:)](xctest/xctcpumetric/init(application:).md)
