Function Prototype

vkGetCalibratedTimestampsKHR

Query calibrated timestamps

In order to be able to correlate the time a particular operation took place at on timelines of different time domains (e.g. a device operation vs. a host operation), Vulkan allows querying calibrated timestamps from multiple time domains.

To query calibrated timestamps from a set of time domains, call:

VkResult vkGetCalibratedTimestampsKHR(
    VkDevice device,
    uint32_t timestampCount,
    const VkCalibratedTimestampInfoKHR* pTimestampInfos,
    uint64_t* pTimestamps,
    uint64_t* pMaxDeviation);

or the equivalent command

VkResult vkGetCalibratedTimestampsEXT(
    VkDevice device,
    uint32_t timestampCount,
    const VkCalibratedTimestampInfoKHR* pTimestampInfos,
    uint64_t* pTimestamps,
    uint64_t* pMaxDeviation);
  • device is the logical device used to perform the query.
  • timestampCount is the number of timestamps to query.
  • pTimestampInfos is a pointer to an array of timestampCount
    VkCalibratedTimestampInfoKHR structures, describing the time domains the calibrated timestamps should be captured from.
  • pTimestamps is a pointer to an array of timestampCount 64-bit unsigned integer values in which the requested calibrated timestamp values are returned.
  • pMaxDeviation is a pointer to a 64-bit unsigned integer value in which the strictly positive maximum deviation, in nanoseconds, of the calibrated timestamp values is returned.

The maximum deviation may vary between calls to vkGetCalibratedTimestampsKHR even for the same set of time domains due to implementation and platform specific reasons. It is the application’s responsibility to assess whether the returned maximum deviation makes the timestamp values suitable for any particular purpose and can choose to re-issue the timestamp calibration call pursuing a lower deviation value.

Calibrated timestamp values can be extrapolated to estimate future coinciding timestamp values, however, depending on the nature of the time domains and other properties of the platform extrapolating values over a sufficiently long period of time may no longer be accurate enough to fit any particular purpose, so applications are expected to re-calibrate the timestamps on a regular basis.

Valid Usage

VUID-vkGetCalibratedTimestampsEXT-timeDomain-09246

The timeDomain value of each VkCalibratedTimestampInfoKHR in pTimestampInfos must be unique

Valid Usage (Implicit)

VUID-vkGetCalibratedTimestampsKHR-pTimestampInfos-parameter

pTimestampInfos must be a valid pointer to an array of timestampCount valid VkCalibratedTimestampInfoKHR structures

VUID-vkGetCalibratedTimestampsKHR-pTimestamps-parameter

pTimestamps must be a valid pointer to an array of timestampCount uint64_t values

VUID-vkGetCalibratedTimestampsKHR-pMaxDeviation-parameter

pMaxDeviation must be a valid pointer to a uint64_t value