|
PAPI
5.0.1.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) |
| inline_static CpuInfo_t * | _papi_hwi_lookup_cpu (unsigned int cpu_num) |
| inline_static int | _papi_hwi_lookup_or_create_cpu (CpuInfo_t **here, unsigned int cpu_num) |
Variables | |
| volatile CpuInfo_t * | _papi_hwi_cpu_head |
CVS: $Id$ Author: Gary Mohr gary.mohr@bull.com
Definition in file cpus.h.
| int _papi_hwi_initialize_cpu | ( | CpuInfo_t ** | dest, |
| unsigned int | cpu_num | ||
| ) |
< Insufficient memory
< No error
Definition at line 185 of file cpus.c.
{
THRDBG("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++ ) {
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 );
}


| inline_static CpuInfo_t* _papi_hwi_lookup_cpu | ( | unsigned int | cpu_num | ) |
Definition at line 31 of file cpus.h.
{
THRDBG("Entry:\n");
CpuInfo_t *tmp;
_papi_hwi_lock( CPUS_LOCK );
tmp = ( CpuInfo_t * ) _papi_hwi_cpu_head;
while ( tmp != NULL ) {
THRDBG( "Examining cpu 0x%x at %p\n", tmp->cpu_num, tmp );
if ( tmp->cpu_num == cpu_num )
break;
tmp = tmp->next;
if ( tmp == _papi_hwi_cpu_head ) {
tmp = NULL;
break;
}
}
if ( tmp ) {
_papi_hwi_cpu_head = tmp;
THRDBG( "Found cpu 0x%x at %p\n", cpu_num, tmp );
} else {
THRDBG( "Did not find cpu 0x%x\n", cpu_num );
}
_papi_hwi_unlock( CPUS_LOCK );
return ( tmp );
}


| inline_static int _papi_hwi_lookup_or_create_cpu | ( | CpuInfo_t ** | here, |
| unsigned int | cpu_num | ||
| ) |
Definition at line 62 of file cpus.h.
{
THRDBG("Entry: here: %p\n", here);
CpuInfo_t *tmp = NULL;
int retval = PAPI_OK;
tmp = _papi_hwi_lookup_cpu(cpu_num);
if ( tmp == NULL )
retval = _papi_hwi_initialize_cpu( &tmp, cpu_num );
if ( retval == PAPI_OK )
*here = tmp;
return ( retval );
}


| int _papi_hwi_shutdown_cpu | ( | CpuInfo_t * | cpu | ) |
< No error
< No error
Definition at line 214 of file cpus.c.
{
THRDBG("Entry: cpu: %p, cpu_num: %d\n", cpu, cpu->cpu_num);
int retval = PAPI_OK;
int i, failure = 0;
remove_cpu( cpu );
THRDBG( "Shutting down cpu %d at %p\n", cpu->cpu_num, cpu );
for ( i = 0; i < papi_num_components; i++ ) {
retval = _papi_hwd[i]->shutdown_thread( cpu->context[i] );
if ( retval != PAPI_OK )
failure = retval;
}
free_cpu( &cpu );
return ( failure );
}


| volatile CpuInfo_t* _papi_hwi_cpu_head |