---
title: "sampleTimestamps:gpuTimestamp:"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/sampletimestamps:gputimestamp:"
---

# sampleTimestamps:gpuTimestamp:

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

## Declaration

```occ
- (void) sampleTimestamps:(MTLTimestamp *) cpuTimestamp gpuTimestamp:(MTLTimestamp *) gpuTimestamp;
```

## Parameters

- `cpuTimestamp`: A pointer the method uses to save a timestamp from the CPU.
- `gpuTimestamp`: A pointer the method uses to save a timestamp from the GPU the device instance represents.

## Mentioned in

Converting GPU timestamps into CPU time

## 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.
