String Handle API
许多 API 调用需要标识 API 对象的名称。String handles(字符串句柄)是名称的指针。字符串句柄能够在运行时高效地处理命名的对象,并使收集的踪迹数据更加紧凑。
要创建并返回一个可与字符串关联的句柄值,请使用以下基元:
__itt_string_handle *ITTAPI __itt_string_handle_createA ( const char *name) __itt_string_handle *ITTAPI __itt_string_handle_createW ( const wchar_t *name)
或以如下方式使用宏:
__itt_string_handle *ITTAPI __itt_string_handle_create (__TEXT("My Task"))
用相同名称连续调用
__itt_string_handle_create
返回相同的值。字符串句柄集在应用程序执行期间预期会保持静态,因此,没有摧毁字符串句柄的机制。任何字符串句柄可以被进程中的任何线程访问,无论字符串句柄是哪个线程创建的。此调用是线程安全的。基元参数:
[in] | name |
输入字符串
|