typedef void( * CUpti_CallbackFunc)(void *userdata, CUpti_CallbackDomain domain, CUpti_CallbackId cbid, const void *cbdata) |
Function type for a callback. The type of the data passed to the callback in cbdata
depends on the domain
. If domain
is CUPTI_CB_DOMAIN_DRIVER_API or CUPTI_CB_DOMAIN_RUNTIME_API the type of cbdata
will be CUpti_CallbackData. If domain
is CUPTI_CB_DOMAIN_RESOURCE the type of cbdata
will be CUpti_ResourceData. If domain
is CUPTI_CB_DOMAIN_SYNCHRONIZE the type of cbdata
will be CUpti_SynchronizeData. If domain
is CUPTI_CB_DOMAIN_NVTX the type of cbdata
will be CUpti_NvtxData.
userdata | User data supplied at subscription of the callback | |
domain | The domain of the callback | |
cbid | The ID of the callback | |
cbdata | Data passed to the callback. |
typedef uint32_t CUpti_CallbackId |
An ID for a driver API, runtime API, resource or synchronization callback. Within a driver API callback this should be interpreted as a CUpti_driver_api_trace_cbid value (these values are defined in cupti_driver_cbid.h). Within a runtime API callback this should be interpreted as a CUpti_runtime_api_trace_cbid value (these values are defined in cupti_runtime_cbid.h). Within a resource API callback this should be interpreted as a CUpti_CallbackIdResource value. Within a synchronize API callback this should be interpreted as a CUpti_CallbackIdSync value.
Specifies the point in an API call that a callback is issued. This value is communicated to the callback function via CUpti_CallbackData::callbackSite.
enum CUpti_CallbackDomain |
Callback domains. Each domain represents callback points for a group of related API functions or CUDA driver activity.
Callback IDs for resource domain, CUPTI_CB_DOMAIN_RESOURCE. This value is communicated to the callback function via the cbid
parameter.
enum CUpti_CallbackIdSync |
Callback IDs for synchronization domain, CUPTI_CB_DOMAIN_SYNCHRONIZE. This value is communicated to the callback function via the cbid
parameter.
CUptiResult cuptiEnableAllDomains | ( | uint32_t | enable, | |
CUpti_SubscriberHandle | subscriber | |||
) |
Enable or disable all callbacks in all domains.
enable | New enable state for all callbacks in all domain. Zero disables all callbacks, non-zero enables all callbacks. | |
subscriber | - Handle to callback subscription |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialized CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if subscriber is invalid |
CUptiResult cuptiEnableCallback | ( | uint32_t | enable, | |
CUpti_SubscriberHandle | subscriber, | |||
CUpti_CallbackDomain | domain, | |||
CUpti_CallbackId | cbid | |||
) |
Enable or disabled callbacks for a subscriber for a specific domain and callback ID.
enable | New enable state for the callback. Zero disables the callback, non-zero enables the callback. | |
subscriber | - Handle to callback subscription | |
domain | The domain of the callback | |
cbid | The ID of the callback |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialized CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if subscriber , domain or cbid is invalid. |
CUptiResult cuptiEnableDomain | ( | uint32_t | enable, | |
CUpti_SubscriberHandle | subscriber, | |||
CUpti_CallbackDomain | domain | |||
) |
Enable or disabled all callbacks for a specific domain.
enable | New enable state for all callbacks in the domain. Zero disables all callbacks, non-zero enables all callbacks. | |
subscriber | - Handle to callback subscription | |
domain | The domain of the callback |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialized CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if subscriber or domain is invalid |
CUptiResult cuptiGetCallbackName | ( | CUpti_CallbackDomain | domain, | |
uint32_t | cbid, | |||
const char ** | name | |||
) |
Returns a pointer to the name c_string in **name
.
domain | The domain of the callback | |
cbid | The ID of the callback | |
name | Returns pointer to the name string on success, NULL otherwise |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_INVALID_PARAMETER | if name is NULL, or if domain or cbid is invalid. |
CUptiResult cuptiGetCallbackState | ( | uint32_t * | enable, | |
CUpti_SubscriberHandle | subscriber, | |||
CUpti_CallbackDomain | domain, | |||
CUpti_CallbackId | cbid | |||
) |
Returns non-zero in *enable
if the callback for a domain and callback ID is enabled, and zero if not enabled.
enable | Returns non-zero if callback enabled, zero if not enabled | |
subscriber | Handle to the initialize subscriber | |
domain | The domain of the callback | |
cbid | The ID of the callback |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialized CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if enabled is NULL, or if subscriber , domain or cbid is invalid. |
CUptiResult cuptiSubscribe | ( | CUpti_SubscriberHandle * | subscriber, | |
CUpti_CallbackFunc | callback, | |||
void * | userdata | |||
) |
Initializes a callback subscriber with a callback function and (optionally) a pointer to user data. The returned subscriber handle can be used to enable and disable the callback for specific domains and callback IDs.
This function does not enable any callbacks.
Thread-safety: this function is thread safe.
subscriber | Returns handle to initialize subscriber | |
callback | The callback function | |
userdata | A pointer to user data. This data will be passed to the callback function via the userdata paramater. |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialize CUPTI | |
CUPTI_ERROR_MULTIPLE_SUBSCRIBERS_NOT_SUPPORTED | if there is already a CUPTI subscriber | |
CUPTI_ERROR_INVALID_PARAMETER | if subscriber is NULL |
CUptiResult cuptiSupportedDomains | ( | size_t * | domainCount, | |
CUpti_DomainTable * | domainTable | |||
) |
Returns in *domainTable
an array of size *domainCount
of all the available callback domains.
domainCount | Returns number of callback domains | |
domainTable | Returns pointer to array of available callback domains |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialize CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if domainCount or domainTable are NULL |
CUptiResult cuptiUnsubscribe | ( | CUpti_SubscriberHandle | subscriber | ) |
Removes a callback subscriber so that no future callbacks will be issued to that subscriber.
subscriber | Handle to the initialize subscriber |
CUPTI_SUCCESS | on success | |
CUPTI_ERROR_NOT_INITIALIZED | if unable to initialized CUPTI | |
CUPTI_ERROR_INVALID_PARAMETER | if subscriber is NULL or not initialized |