<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/sampleTimestamps:gpuTimestamp:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)sampleTimestamps:gpuTimestamp:"
  },
  "title" : "sampleTimestamps:gpuTimestamp:"
}
-->

# sampleTimestamps:gpuTimestamp:

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

```
- (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.

## Discussion

For an example of how and when to use corresponding timestamps from the CPU and GPU, see [Converting GPU timestamps into CPU time](/documentation/Metal/converting-gpu-timestamps-into-cpu-time).

---

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)