CLGETEVENTPROFILINGI(3clc)
π CLGETEVENTPROFILINGI(3clc) β the OpenCL Manual, bestie edition π
okay so we're in the OpenCL Manual and today's main character is clGetEventProfilingInfo(3clc). she's the one who tells you how long your commands actually took on the device. timestamps, girl. we love a receipts moment. π
β¨ NAME β¨
clGetEventProfilingInfo β returns profiling information for the command associated with event if profiling is enabled.
lowkey the whole plot in one line. if profiling isn't enabled, she's not talking to you. π
cl_int clGetEventProfilingInfo(cl_event event,
cl_profiling_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
πΈ PARAMETERS πΈ
eventβ the event object. the one we're snooping on. πparam_nameβ which piece of profiling data you wanna query. the full list of supportedparam_nametypes, and what comes back inparam_value, is down in the parameter queries list below. no skimming, bestie.param_value_sizeβ the size, in bytes, of the memory thatparam_valuepoints at. this size must be β₯ the size of the return type listed below. fr fr, respect the type size.param_valueβ a pointer to the memory where the queried result gets returned. ifparam_valueisNULL, it's just ignored. she said no pressure.param_value_size_retβ returns the actual size, in bytes, of the data copied toparam_value. ifparam_value_size_retisNULL, it's ignored too. iconic, both of them.
here's the table of clGetEventProfilingInfo parameter queries, but as a list because we're terminal girls π
π¦ CL_PROFILING_COMMAND_QUEUED
- Return type:
cl_ulong - Info returned in
param_value: a 64-bit value describing the current device time counter in nanoseconds when the command identified byeventis enqueued in a command-queue by the host.
π¦ CL_PROFILING_COMMAND_SUBMIT
- Return type:
cl_ulong - Info returned in
param_value: a 64-bit value describing the current device time counter in nanoseconds when the command identified byeventthat has been enqueued is submitted by the host to the device associated with the command-queue.
π¦ CL_PROFILING_COMMAND_START
- Return type:
cl_ulong - Info returned in
param_value: a 64-bit value describing the current device time counter in nanoseconds when the command identified byeventstarts execution on the device.
π¦ CL_PROFILING_COMMAND_END
- Return type:
cl_ulong - Info returned in
param_value: a 64-bit value describing the current device time counter in nanoseconds when the command identified byeventhas finished execution on the device.
β¨ NOTES β¨
the unsigned 64-bit values you get back can be used to measure the time in nano-seconds consumed by OpenCL commands. it's giving stopwatch but make it 64-bit. β±οΈ
OpenCL devices are required to correctly track time across changes in device frequency and power states. not optional, not vibes-based. and CL_DEVICE_PROFILING_TIMER_RESOLUTION specifies the resolution of the timer, i.e. the number of nanoseconds that elapse before the timer is incremented.
event objects can be used to capture profiling information that measures the execution time of a command. profiling of OpenCL commands can be enabled either by using a command-queue created with the CL_QUEUE_PROFILING_ENABLE flag set in the properties argument to clCreateCommandQueue(3clc). so like, go turn it on first. π
π ERRORS π
returns CL_SUCCESS if the function executes successfully and the profiling information has been recorded. otherwise, she returns one of the following, and bestie she is not subtle about it:
CL_PROFILING_INFO_NOT_AVAILABLEβ if theCL_QUEUE_PROFILING_ENABLEflag is not set for the command-queue, if the execution status of the command identified byeventis notCL_COMPLETE, or ifeventis a user event object.CL_INVALID_VALUEβ ifparam_nameis not valid, or if the size in bytes specified byparam_value_sizeis < the size of the return type described in the table above andparam_valueis notNULL.CL_INVALID_EVENTβ ifeventis not a valid event object.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.
heads up: CL_PROFILING_INFO_NOT_AVAILABLE is the one that shows up when you forgot to enable profiling. that's a you problem, not a her problem. π
π SPECIFICATION π
OpenCL Specification[1]
π«Ά SEE ALSO π«Ά
π AUTHORS π
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 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.
π NOTES π
- OpenCL Specification β page 190, section 5.12 - Profiling Operations on Memory Objects and Kernels
and that's the whole page, bestie. brought to you by The Khronos Group, dated 01/14/2021, filed under CLGETEVENTPROFILINGI(3clc) β¨ go measure something. slay. π
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms