User Guide

  • 2020
  • 06/18/2020
  • Public Content
Contents

Thread Naming API

By default, each thread in your application is displayed in the
timeline
track with a default label generated from the process ID and the thread ID, or with the OS thread name. You can use the Thread Naming API in your code to give threads meaningful names.
Thread Naming API is a per-thread function that works in all states (paused or resumed).
Use This Primitive
To Do This
void
__itt_thread_set_name
(const __itt_char *name)
Set thread name using a char or Unicode string.
Parameters:
[in]
name
The thread name
void
__itt_thread_ignore
(void)
Indicate that this thread should be ignored from analysis. It will not affect the concurrency of the application. It will not be visible in the
Timeline
pane.
If the thread name is set multiple times, only the last name is used.

Usage Example

You can use the following thread naming example to give a meaningful name to the thread you wish to focus on and ignore the service thread.
DWORD WINAPI service_thread(LPVOID lpArg) { __itt_thread_ignore(); // Do service work here. This thread will not be displayed. return 0; } DWORD WINAPI thread_function(LPVOID lpArg) { __itt_thread_set_name(“My worker thread”); // Do thread work here return 0; } int main(int argc, char* argv[]) { ... CreateThread(NULL, 0, service_thread, NULL, 0, NULL); CreateThread(NULL, 0, thread_function, NULL, 0, NULL); ... return 0; }

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804