Timing

This section covers querying timestamps, and calibrating the GPU and CPU timestamp counters.

Timestamp Frequency

Applications can query the GPU timestamp frequency on a per-command queue basis (refer to the ID3D12CommandQueue::GetTimestampFrequency method).

The returned frequency is measured in Hz (ticks/sec). This API fails (and returns E_FAIL) if the specified command queue does not support timestamps (see the table in the Queries section).

Timestamp Calibration

D3D12 enables applications to correlate results obtained from timestamp queries with results obtained from calling QueryPerformanceCounter. This is enabled by the call ID3D12CommandQueue::GetClockCalibration.

GetClockCalibration samples the GPU timestamp counter for a given command queue and samples the CPU counter via QueryPerformanceCounter at nearly the same time. Again this API fails (returning E_FAIL) if the specified command queue does not support timestamps (see the table in the Queries section).

Note that GPU and CPU timestamp counters are not necessarily directly related to the clock speed of these processors, but instead work from timestamp ticks.

Counters and Queries

ID3D12Device::SetStablePowerState

ID3D12Object::SetName

ID3DUserDefinedAnnotation

Performance Measurement