clGetHostTimer

Return the current value of the host clock as seen by device.

cl_int clGetHostTimer ( cl_device_id  device ,
  cl_ulong *  host_timestamp )

Parameters

device

A device returned by clGetDeviceIDs.

host_timestamp

Will be updated with the value of the current timer in nanoseconds. The resolution of the timer may be queried via clGetPlatformInfo and the flag CL_PLATFORM_HOST_TIMER_RESOLUTION.

Notes

Return the current value of the host clock as seen by device. This value is in the same timebase as the host_timestamp returned from clGetDeviceAndHostTimer. The implementation will return with as low a latency as possible to allow a correlation with a subsequent application sampled time. The host timestamp and device timestamp returned by this function and clGetDeviceAndHostTimer 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.

Errors

clGetHostTimer will return CL_SUCCESS with a time value in host_timestamp if provided. Otherwise, it returns one of the following errors:

  • CL_INVALID_DEVICE if device is not a valid OpenCL device.
  • CL_INVALID_VALUE if host_timestamp is NULL.
  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

Specification

OpenCL Specification

Also see

clGetDeviceAndHostTimer, clGetPlatformInfo

Copyright © 2007-2015 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.