Go to the source code of this file.
◆ _papi_hwi_gather_all_thrspec_data()
Definition at line 555 of file threads.c.
557 int didsomething = 0;
566 memcpy( &where->
id[didsomething], &foo->
tid,
567 sizeof ( where->
id[didsomething] ) );
575 if ( ( where->
id ) || ( where->
data ) ) {
576 if ( didsomething >= where->
num )
584 where->
num = didsomething;
struct _ThreadInfo * next
volatile ThreadInfo_t * _papi_hwi_thread_head
void * thread_storage[PAPI_MAX_TLS]
inline_static int _papi_hwi_lock(int lck)
inline_static int _papi_hwi_unlock(int lck)
◆ _papi_hwi_init_global_threads()
| int _papi_hwi_init_global_threads |
( |
void |
| ) |
|
Definition at line 528 of file threads.c.
535 #if defined(HAVE_THREAD_LOCAL_STORAGE) 540 #if defined(ANY_THREAD_GETS_SIGNAL)
static int lookup_and_set_thread_symbols(void)
volatile ThreadInfo_t * _papi_hwi_thread_head
inline_static int _papi_hwi_lock(int lck)
inline_static int _papi_hwi_unlock(int lck)
THREAD_LOCAL_STORAGE_KEYWORD ThreadInfo_t * _papi_hwi_my_thread
int _papi_hwi_initialize_thread(ThreadInfo_t **dest, int tid)
int(* _papi_hwi_thread_kill_fn)(int, int)
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ _papi_hwi_initialize_thread()
| int _papi_hwi_initialize_thread |
( |
ThreadInfo_t ** |
dest, |
|
|
int |
tid |
|
) |
| |
Definition at line 278 of file threads.c.
292 if (
_papi_hwd[
i]->cmp_info.disabled)
continue;
static void free_thread(ThreadInfo_t **thread)
static ThreadInfo_t * allocate_thread(int tid)
static void insert_thread(ThreadInfo_t *entry, int tid)
struct papi_vectors * _papi_hwd[]
◆ _papi_hwi_set_thread_id_fn()
| int _papi_hwi_set_thread_id_fn |
( |
unsigned long(*)(void) |
id_fn | ) |
|
Definition at line 352 of file threads.c.
354 #if !defined(ANY_THREAD_GETS_SIGNAL) 368 THRDBG(
"Set new thread id function to %p\n", id_fn );
377 THRDBG(
"Skipping set of thread id function\n" );
struct _ThreadInfo * next
#define THRDBG(format, args...)
volatile ThreadInfo_t * _papi_hwi_thread_head
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ _papi_hwi_shutdown_global_threads()
| int _papi_hwi_shutdown_global_threads |
( |
void |
| ) |
|
Definition at line 457 of file threads.c.
461 unsigned long our_tid;
466 THRDBG(
"Did not find my thread for shutdown!\n" );
473 THRDBG(
"Shutting down %ld\n",our_tid);
495 THRDBG(
"looking at #%d %ld our_tid: %ld alloc_tid: %ld\n",
496 i,
tmp->tid,our_tid,
tmp->allocator_tid);
498 THRDBG(
"Also removing thread %ld\n",
tmp->tid);
515 #if defined(HAVE_THREAD_LOCAL_STORAGE) 520 #if defined(ANY_THREAD_GETS_SIGNAL)
#define THRDBG(format, args...)
volatile ThreadInfo_t * _papi_hwi_thread_head
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
THREAD_LOCAL_STORAGE_KEYWORD ThreadInfo_t * _papi_hwi_my_thread
int _papi_hwi_shutdown_thread(ThreadInfo_t *thread, int force_shutdown)
int(* _papi_hwi_thread_kill_fn)(int, int)
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ _papi_hwi_shutdown_thread()
| int _papi_hwi_shutdown_thread |
( |
ThreadInfo_t * |
thread, |
|
|
int |
force_shutdown |
|
) |
| |
Definition at line 418 of file threads.c.
425 tid = ( *_papi_hwi_thread_id_fn ) ( );
427 tid = (
unsigned long ) getpid( );
429 THRDBG(
"Want to shutdown thread %ld, alloc %ld, our_tid: %ld\n",
434 if ((
thread->tid==tid) || (
thread->allocator_tid == tid ) || force_shutdown) {
441 if (
_papi_hwd[
i]->cmp_info.disabled)
continue;
449 THRDBG(
"Skipping shutdown thread %ld at %p, thread %ld not allocator!\n",
static void free_thread(ThreadInfo_t **thread)
#define THRDBG(format, args...)
static int _papi_hwi_thread_free_eventsets(long tid)
struct papi_vectors * _papi_hwd[]
static int remove_thread(ThreadInfo_t *entry)
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ _papi_hwi_thread_free_eventsets()
| static int _papi_hwi_thread_free_eventsets |
( |
long |
tid | ) |
|
|
static |
Definition at line 384 of file threads.c.
397 if ( ( ESI ) && (ESI->
master!=NULL) ) {
399 if ( ESI->
master == master ) {
#define THRDBG(format, args...)
inline_static int _papi_hwi_lock(int lck)
DynamicArray_t global_eventset_map
struct _ThreadInfo * master
inline_static int _papi_hwi_unlock(int lck)
papi_mdi_t _papi_hwi_system_info
EventSetInfo_t ** dataSlotArray
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
void _papi_hwi_free_EventSet(EventSetInfo_t *ESI)
◆ allocate_thread()
Definition at line 96 of file threads.c.
117 thread->running_eventset =
120 if ( !
thread->running_eventset ) {
129 thread->running_eventset[
i] = NULL;
130 if (
thread->context[
i] == NULL ) {
131 for (
i--;
i >= 0;
i-- )
137 memset(
thread->context[
i], 0x00,
142 thread->tid = ( *_papi_hwi_thread_id_fn ) ( );
145 thread->tid = (
unsigned long ) getpid( );
156 THRDBG(
"Allocated thread %ld at %p, allocator: %ld\n",
thread->tid,
#define THRDBG(format, args...)
struct papi_vectors * _papi_hwd[]
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ free_thread()
Definition at line 164 of file threads.c.
167 THRDBG(
"Freeing thread %ld at %p\n", ( *thread )->tid, *
thread );
170 if ( ( *thread )->context[
i] )
174 if ( ( *thread )->context )
177 if ( ( *thread )->running_eventset )
178 papi_free( ( *thread )->running_eventset );
#define THRDBG(format, args...)
◆ insert_thread()
Definition at line 186 of file threads.c.
191 THRDBG(
"_papi_hwi_thread_head is NULL\n" );
194 THRDBG(
"_papi_hwi_thread_head was thread %ld at %p\n",
200 THRDBG(
"_papi_hwi_thread_head was thread %ld at %p\n",
208 THRDBG(
"_papi_hwi_thread_head now thread %ld at %p\n",
213 #if defined(HAVE_THREAD_LOCAL_STORAGE) 217 THRDBG(
"TLS for thread %ld is now %p\n", entry->
tid,
struct _ThreadInfo * next
#define THRDBG(format, args...)
volatile ThreadInfo_t * _papi_hwi_thread_head
inline_static int _papi_hwi_lock(int lck)
inline_static int _papi_hwi_unlock(int lck)
THREAD_LOCAL_STORAGE_KEYWORD ThreadInfo_t * _papi_hwi_my_thread
◆ lookup_and_set_thread_symbols()
| static int lookup_and_set_thread_symbols |
( |
void |
| ) |
|
|
static |
Definition at line 55 of file threads.c.
57 #if defined(ANY_THREAD_GETS_SIGNAL) 59 char *error_ptc = NULL, *error_ptk = NULL;
60 void *symbol_ptc = NULL, *symbol_ptk = NULL, *handle = NULL;
62 handle = dlopen( NULL, RTLD_LAZY );
63 if ( handle == NULL ) {
69 symbol_ptc = dlsym( handle,
"pthread_self" );
70 if ( symbol_ptc == NULL ) {
71 error_ptc = dlerror( );
72 THRDBG(
"dlsym(%p,pthread_self) returned NULL: %s\n",
73 ( error_ptc ? error_ptc :
"No error, NULL symbol!" ) );
76 symbol_ptk = dlsym( handle,
"pthread_kill" );
77 if ( symbol_ptk == NULL ) {
78 error_ptk = dlerror( );
79 THRDBG(
"dlsym(%p,pthread_kill) returned NULL: %s\n",
80 ( error_ptk ? error_ptk :
"No error, NULL symbol!" ) );
#define THRDBG(format, args...)
void PAPIERROR(char *format,...)
int(* _papi_hwi_thread_kill_fn)(int, int)
unsigned long(* _papi_hwi_thread_id_fn)(void)
◆ remove_thread()
Definition at line 226 of file threads.c.
232 THRDBG(
"_papi_hwi_thread_head was thread %ld at %p\n",
239 ( entry !=
tmp ) || ( prev == NULL );
tmp =
tmp->next ) {
243 if (
tmp != entry ) {
244 THRDBG(
"Thread %ld at %p was not found in the thread list!\n",
254 THRDBG(
"_papi_hwi_thread_head now NULL\n" );
256 prev->next =
tmp->next;
260 THRDBG(
"_papi_hwi_thread_head now thread %ld at %p\n",
263 THRDBG(
"Removed thread %p from list\n",
tmp );
268 #if defined(HAVE_THREAD_LOCAL_STORAGE) 270 THRDBG(
"TLS for thread %ld is now %p\n", entry->
tid,
#define THRDBG(format, args...)
volatile ThreadInfo_t * _papi_hwi_thread_head
inline_static int _papi_hwi_lock(int lck)
inline_static int _papi_hwi_unlock(int lck)
THREAD_LOCAL_STORAGE_KEYWORD ThreadInfo_t * _papi_hwi_my_thread
◆ _papi_hwi_my_thread
◆ _papi_hwi_thread_head
The list of threads, gets initialized to master process with TID of getpid()
Definition at line 32 of file threads.c.
◆ _papi_hwi_thread_id_fn
| unsigned long( * _papi_hwi_thread_id_fn) (void) |
Function that returns an unsigned long int thread identifier
Definition at line 42 of file threads.c.