|
13 | 13 | struct _cl_tracing_handle; |
14 | 14 | typedef _cl_tracing_handle *cl_tracing_handle; |
15 | 15 |
|
| 16 | +//! Enumeration of callback call sites |
16 | 17 | typedef enum _cl_callback_site { |
17 | | - CL_CALLBACK_SITE_ENTER = 0, |
18 | | - CL_CALLBACK_SITE_EXIT = 1 |
| 18 | + CL_CALLBACK_SITE_ENTER = 0, //!< Before the function |
| 19 | + CL_CALLBACK_SITE_EXIT = 1 //!< After the function |
19 | 20 | } cl_callback_site; |
20 | 21 |
|
| 22 | +/*! |
| 23 | + \brief Callback data structure |
| 24 | +
|
| 25 | + The structure contains information about the traced function. |
| 26 | + Function name allows to determine which function is currently traced. |
| 27 | + Call site is used to determine if the callback was called at the beginning |
| 28 | + or at the end of function. |
| 29 | + Correlation ID and Data fields allow to associate the callback on |
| 30 | + enter with the callback on exit and pass any piece of data between them. |
| 31 | + Function arguments and return value available both for reading and writing. |
| 32 | + Return value will be available only within on-exit callback |
| 33 | +*/ |
21 | 34 | typedef struct _cl_callback_data { |
22 | | - cl_callback_site site; |
23 | | - cl_uint correlationId; |
24 | | - cl_ulong *correlationData; |
25 | | - const char *functionName; |
26 | | - const void *functionParams; |
27 | | - void *functionReturnValue; |
| 35 | + cl_callback_site site; //!< Call site, can be ENTER or EXIT |
| 36 | + cl_uint correlationId; //!< Correlation identifier, the same for ENTER |
| 37 | + //!< and EXIT callbacks |
| 38 | + cl_ulong *correlationData; //!< Pointer to correlation data repository, |
| 39 | + //!< can be used to move data from ENTER to |
| 40 | + //!< EXIT callback |
| 41 | + const char *functionName; //!< Name of the traced function |
| 42 | + const void *functionParams; //!< Traced function arguments, should be |
| 43 | + //!< casted to appropriate params structure |
| 44 | + void *functionReturnValue; //!< Return value for the traced function |
28 | 45 | } cl_callback_data; |
29 | 46 |
|
| 47 | +//! Enumeration of supported functions for tracing |
30 | 48 | typedef enum _cl_function_id { |
31 | 49 | CL_FUNCTION_clBuildProgram = 0, |
32 | 50 | CL_FUNCTION_clCloneKernel = 1, |
@@ -149,6 +167,16 @@ typedef enum _cl_function_id { |
149 | 167 | CL_FUNCTION_COUNT = 118, |
150 | 168 | } cl_function_id; |
151 | 169 |
|
| 170 | +/*! |
| 171 | + User-defined tracing callback prototype |
| 172 | + \param[in] fid Identifier of the function for which the callback is called |
| 173 | + \param[in] callbackData Data structure with information about the traced |
| 174 | + function |
| 175 | + \param[in] userData User-defined data pointer passed through |
| 176 | + clCreateTracingHandleINTEL() function |
| 177 | +
|
| 178 | + Thread Safety: must be guaranteed by customer |
| 179 | +*/ |
152 | 180 | typedef void (*cl_tracing_callback)(cl_function_id fid, cl_callback_data *callbackData, void *userData); |
153 | 181 |
|
154 | 182 | typedef struct _cl_params_clBuildProgram { |
|
0 commit comments