HPCToolkit
threadmgr.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/sysinfo.h>
#include "threadmgr.h"
#include "thread_data.h"
#include "write_data.h"
#include "trace.h"
#include "sample_sources_all.h"
#include <lib/prof-lean/stdatomic.h>
#include <lib/prof-lean/spinlock.h>
#include <include/queue.h>
#include <monitor.h>
Include dependency graph for threadmgr.c:

Go to the source code of this file.

Classes

struct  thread_list_s
 

Macros

#define HPCRUN_OPTION_MERGE_THREAD   "HPCRUN_MERGE_THREADS"
 
#define HPCRUN_THREADS_DEBUG   0
 

Typedefs

typedef struct thread_list_s thread_list_t
 

Functions

static SLIST_HEAD (thread_list_head, thread_list_s)
 
static int32_t adjust_num_logical_threads (int32_t val)
 
static int32_t get_num_logical_threads ()
 
static bool is_compact_thread ()
 
static thread_data_tallocate_and_init_thread_data (int id, cct_ctxt_t *thr_ctxt)
 
static void finalize_thread_data (core_profile_trace_data_t *current_data)
 
static thread_list_tgrab_thread_data ()
 
static void * finalize_all_thread_data (void *arg)
 
void hpcrun_threadmgr_thread_new ()
 
void hpcrun_threadmgr_thread_delete ()
 
int hpcrun_threadmgr_thread_count ()
 
int hpcrun_threadMgr_compact_thread ()
 
bool hpcrun_threadMgr_data_get (int id, cct_ctxt_t *thr_ctxt, thread_data_t **data)
 
void hpcrun_threadMgr_data_put (epoch_t *epoch, thread_data_t *data)
 
void hpcrun_threadMgr_data_fini (thread_data_t *td)
 

Variables

static atomic_int_least32_t threadmgr_active_threads = ATOMIC_VAR_INIT(1)
 
static atomic_int_least32_t threadmgr_num_threads = ATOMIC_VAR_INIT(1)
 

Macro Definition Documentation

◆ HPCRUN_OPTION_MERGE_THREAD

#define HPCRUN_OPTION_MERGE_THREAD   "HPCRUN_MERGE_THREADS"

Definition at line 84 of file threadmgr.c.

◆ HPCRUN_THREADS_DEBUG

#define HPCRUN_THREADS_DEBUG   0

Definition at line 85 of file threadmgr.c.

Typedef Documentation

◆ thread_list_t

typedef struct thread_list_s thread_list_t

Function Documentation

◆ adjust_num_logical_threads()

static int32_t adjust_num_logical_threads ( int32_t  val)
static

Definition at line 123 of file threadmgr.c.

Here is the caller graph for this function:

◆ allocate_and_init_thread_data()

static thread_data_t* allocate_and_init_thread_data ( int  id,
cct_ctxt_t thr_ctxt 
)
static

Definition at line 142 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize_all_thread_data()

static void* finalize_all_thread_data ( void *  arg)
static

Definition at line 198 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize_thread_data()

static void finalize_thread_data ( core_profile_trace_data_t current_data)
static

Definition at line 172 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_num_logical_threads()

static int32_t get_num_logical_threads ( )
static

Definition at line 130 of file threadmgr.c.

Here is the caller graph for this function:

◆ grab_thread_data()

static thread_list_t* grab_thread_data ( )
static

Definition at line 180 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_threadMgr_compact_thread()

int hpcrun_threadMgr_compact_thread ( )

Return the type of HPCRUN_OPTION_MERGE_THREAD option Possible value: OPTION_COMPACT_THREAD : (default) compact thread is required OPTION_NO_COMPACT_THREAD : do not compact the threads

Definition at line 244 of file threadmgr.c.

Here is the caller graph for this function:

◆ hpcrun_threadMgr_data_fini()

void hpcrun_threadMgr_data_fini ( thread_data_t td)

Definition at line 354 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_threadMgr_data_get()

bool hpcrun_threadMgr_data_get ( int  id,
cct_ctxt_t thr_ctxt,
thread_data_t **  data 
)

Definition at line 275 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_threadMgr_data_put()

void hpcrun_threadMgr_data_put ( epoch_t epoch,
thread_data_t data 
)

Definition at line 310 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_threadmgr_thread_count()

int hpcrun_threadmgr_thread_count ( )

Definition at line 232 of file threadmgr.c.

Here is the caller graph for this function:

◆ hpcrun_threadmgr_thread_delete()

void hpcrun_threadmgr_thread_delete ( )

Definition at line 225 of file threadmgr.c.

Here is the caller graph for this function:

◆ hpcrun_threadmgr_thread_new()

void hpcrun_threadmgr_thread_new ( )

Definition at line 218 of file threadmgr.c.

Here is the caller graph for this function:

◆ is_compact_thread()

static bool is_compact_thread ( )
static

Definition at line 136 of file threadmgr.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SLIST_HEAD()

static SLIST_HEAD ( thread_list_head  ,
thread_list_s   
)
static

Definition at line 107 of file threadmgr.c.

Variable Documentation

◆ threadmgr_active_threads

atomic_int_least32_t threadmgr_active_threads = ATOMIC_VAR_INIT(1)
static

Definition at line 99 of file threadmgr.c.

◆ threadmgr_num_threads

atomic_int_least32_t threadmgr_num_threads = ATOMIC_VAR_INIT(1)
static

Definition at line 101 of file threadmgr.c.