|
PAPI
5.3.0.0
|

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) |
Author: Gary Mohr gary.mohr@bull.com
Definition in file cpus.h.
| int _papi_hwi_initialize_cpu | ( | CpuInfo_t ** | dest, |
| unsigned int | cpu_num | ||
| ) |
Definition at line 275 of file cpus.c.
{
APIDBG("Entry: dest: %p, *dest: %p, cpu_num: %d\n", dest, *dest, cpu_num);
int retval;
CpuInfo_t *cpu;
int i;
if ( ( cpu = allocate_cpu(cpu_num) ) == NULL ) {
*dest = NULL;
return PAPI_ENOMEM;
}
/* Call the component to fill in anything special. */
for ( i = 0; i < papi_num_components; i++ ) {
if (_papi_hwd[i]->cmp_info.disabled) continue;
retval = _papi_hwd[i]->init_thread( cpu->context[i] );
if ( retval ) {
free_cpu( &cpu );
*dest = NULL;
return retval;
}
}
insert_cpu( cpu );
*dest = cpu;
return PAPI_OK;
}


| int _papi_hwi_lookup_or_create_cpu | ( | CpuInfo_t ** | here, |
| unsigned int | cpu_num | ||
| ) |
Definition at line 59 of file cpus.c.
{
APIDBG("Entry: here: %p\n", here);
CpuInfo_t *tmp = NULL;
int retval = PAPI_OK;
_papi_hwi_lock( CPUS_LOCK );
tmp = _papi_hwi_lookup_cpu(cpu_num);
if ( tmp == NULL ) {
retval = _papi_hwi_initialize_cpu( &tmp, cpu_num );
}
/* Increment use count */
tmp->num_users++;
if ( retval == PAPI_OK ) {
*here = tmp;
}
_papi_hwi_unlock( CPUS_LOCK );
return retval;
}

