unsigned long int tid;
HighLevelInfo *state = NULL;
if (retval = PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
handle_error(retval);
if (retval = PAPI_thread_init(pthread_self) != PAPI_OK)
handle_error(retval);
/*
* Do we have the thread specific data setup yet?
*/
if ((retval = PAPI_get_thr_specific(1, (void *) &state))
!= PAPI_OK || state == NULL) {
state = (HighLevelInfo *) malloc(sizeof(HighLevelInfo));
if (state == NULL)
return (PAPI_ESYS);
memset(state, 0, sizeof(HighLevelInfo));
state->EventSet = -1;
if ((retval = PAPI_create_eventset(&state->EventSet)) != PAPI_OK)
return (PAPI_ESYS);
if ((retval = PAPI_set_thr_specific(1, state)) != PAPI_OK)
return (retval);
}