---
title: sampleTimestamps()
framework: metal
role: symbol
role_heading: Instance Method
path: metal/mtldevice/sampletimestamps()
---

# sampleTimestamps()

Captures and returns a CPU timestamp and a GPU timestamp from the same moment in time.

## Declaration

```swift
func sampleTimestamps() -> (cpu: MTLTimestamp, gpu: MTLTimestamp)
```

## Mentioned in

Converting GPU timestamps into CPU time Converting a GPU’s counter data into a readable format

## Return Value

Return Value A tuple that contains the CPU and GPU timestamps.

## Discussion

Discussion For an example of how and when to use corresponding timestamps from the CPU and GPU, see Converting GPU timestamps into CPU time.
