Beispiel #1
0
static void ITT_init_strings() {
    for ( int i = 0; i < NUM_STRINGS; ++i ) {
#if _WIN32||_WIN64
        strings_for_itt[i].itt_str_handle = __itt_string_handle_createA( strings_for_itt[i].str );
#else
        strings_for_itt[i].itt_str_handle = __itt_string_handle_create( strings_for_itt[i].str );
#endif
    }
}
Beispiel #2
0
#include <vector>

// ITT Metadata are sometimes useful for telling a bunch of tasks apart.
// Here, we have a function that accepts a parameter that, depending on its
// value, will cause the function to run quickly or slowly.
// 
// If we trace this function without a parameter, all we will see is 
// that one of these functions is really long, but won't know why.
//
// The __itt_metadata_add call below adds the actual index value to the trace
// In the GUI, we can then use this captured parameter to decide whether there
// is a correlation between the parameter and the function's duration.
//

__itt_domain* pD = __itt_domain_create(L"gpa_metadata_sample");
__itt_string_handle* pSH1 = __itt_string_handle_createA("Example");
__itt_string_handle* pSH2 = __itt_string_handle_create(L"index");

void Example(int index)
{
	__itt_task_begin(pD, __itt_null, __itt_null, pSH1);

	__itt_metadata_add(pD, __itt_null, pSH2, __itt_metadata_s32, 1, (void*)&index);

	__itt_metadata_str_add(pD, __itt_null, pSH1, L"Example is running", 0);

    if(index == 10) 
	{
        Sleep(30);
    } 
	else