C Specification
To query device and host timestamps, call the function:
// Provided by CL_VERSION_2_1
cl_int clGetDeviceAndHostTimer(
cl_device_id device,
cl_ulong* device_timestamp,
cl_ulong* host_timestamp);
| clGetDeviceAndHostTimer is missing before version 2.1. |
Parameters
-
device is a device returned by clGetDeviceIDs.
-
device_timestamp will be updated with the value of the device timer in nanoseconds. The resolution of the timer is the same as the device profiling timer returned by clGetDeviceInfo and the
CL_DEVICE_query.PROFILING_ TIMER_ RESOLUTION -
host_timestamp will be updated with the value of the host timer in nanoseconds at the closest possible point in time to that at which device_timer was returned. The resolution of the timer may be queried via clGetPlatformInfo and the flag
CL_PLATFORM_.HOST_ TIMER_ RESOLUTION
Description
clGetDeviceAndHostTimer returns a reasonably synchronized pair of timestamps from the device timer and the host timer as seen by device. Implementations may need to execute this query with a high latency in order to provide reasonable synchronization of the timestamps. The host timestamp and device timestamp returned by this function and clGetHostTimer each have an implementation-defined timebase. The timestamps will always be in their respective timebases regardless of which query function is used. The timestamp returned from clGetEventProfilingInfo for an event on a device and a device timestamp queried from the same device will always be in the same timebase.
clGetDeviceAndHostTimer will return CL_SUCCESS with a time value in
host_timestamp if provided.
Otherwise, it returns one of the following errors:
-
CL_INVALID_if device is not a valid device.DEVICE -
CL_INVALID_if the platform associated with device does not support device and host timer synchronization.OPERATION -
CL_INVALID_if host_timestamp or device_timestamp isVALUE NULL. -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.