PAPI 7.1.0.0
Loading...
Searching...
No Matches
cpus.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CpuInfo_t
 

Functions

int _papi_hwi_initialize_cpu (CpuInfo_t **dest, unsigned int cpu_num)
 
int _papi_hwi_shutdown_cpu (CpuInfo_t *cpu)
 
int _papi_hwi_lookup_or_create_cpu (CpuInfo_t **here, unsigned int cpu_num)
 

Detailed Description

Author: Gary Mohr gary..nosp@m.mohr.nosp@m.@bull.nosp@m..com

Definition in file cpus.h.

Function Documentation

◆ _papi_hwi_initialize_cpu()

int _papi_hwi_initialize_cpu ( CpuInfo_t **  dest,
unsigned int  cpu_num 
)

Definition at line 275 of file cpus.c.

276{
277 APIDBG("Entry: dest: %p, *dest: %p, cpu_num: %d\n", dest, *dest, cpu_num);
278
279 int retval;
280 CpuInfo_t *cpu;
281 int i;
282
283 if ( ( cpu = allocate_cpu(cpu_num) ) == NULL ) {
284 *dest = NULL;
285 return PAPI_ENOMEM;
286 }
287
288 /* Call the component to fill in anything special. */
289 for ( i = 0; i < papi_num_components; i++ ) {
290 if (_papi_hwd[i]->cmp_info.disabled &&
291 _papi_hwd[i]->cmp_info.disabled != PAPI_EDELAY_INIT)
292 continue;
293 retval = _papi_hwd[i]->init_thread( cpu->context[i] );
294 if ( retval ) {
295 free_cpu( &cpu );
296 *dest = NULL;
297 return retval;
298 }
299 }
300
301 insert_cpu( cpu );
302
303 *dest = cpu;
304 return PAPI_OK;
305}
int i
struct papi_vectors * _papi_hwd[]
static CpuInfo_t * allocate_cpu(unsigned int cpu_num)
Definition: cpus.c:87
static void insert_cpu(CpuInfo_t *entry)
Definition: cpus.c:243
static void free_cpu(CpuInfo_t **cpu)
Definition: cpus.c:190
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_EDELAY_INIT
Definition: f90papi.h:271
#define PAPI_ENOMEM
Definition: f90papi.h:16
#define APIDBG(format, args...)
Definition: papi_debug.h:65
int papi_num_components
Definition: cpus.h:11
hwd_context_t ** context
Definition: cpus.h:14
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _papi_hwi_lookup_or_create_cpu()

int _papi_hwi_lookup_or_create_cpu ( CpuInfo_t **  here,
unsigned int  cpu_num 
)

Definition at line 59 of file cpus.c.

60{
61 APIDBG("Entry: here: %p\n", here);
62
63 CpuInfo_t *tmp = NULL;
64 int retval = PAPI_OK;
65
67
68 tmp = _papi_hwi_lookup_cpu(cpu_num);
69 if ( tmp == NULL ) {
70 retval = _papi_hwi_initialize_cpu( &tmp, cpu_num );
71 }
72
73 /* Increment use count */
74 tmp->num_users++;
75
76 if ( retval == PAPI_OK ) {
77 *here = tmp;
78 }
79
81
82 return retval;
83}
double tmp
int _papi_hwi_initialize_cpu(CpuInfo_t **dest, unsigned int cpu_num)
Definition: cpus.c:275
static CpuInfo_t * _papi_hwi_lookup_cpu(unsigned int cpu_num)
Definition: cpus.c:29
#define CPUS_LOCK
Definition: papi_internal.h:92
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:69
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _papi_hwi_shutdown_cpu()

int _papi_hwi_shutdown_cpu ( CpuInfo_t cpu)

Definition at line 308 of file cpus.c.

309{
310 APIDBG("Entry: cpu: %p, cpu_num: %d\n", cpu, cpu->cpu_num);
311
312 free_cpu( &cpu );
313
314 return PAPI_OK;
315}
unsigned int cpu_num
Definition: cpus.h:12
Here is the call graph for this function:
Here is the caller graph for this function: