PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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) continue;
291  retval = _papi_hwd[i]->init_thread( cpu->context[i] );
292  if ( retval ) {
293  free_cpu( &cpu );
294  *dest = NULL;
295  return retval;
296  }
297  }
298 
299  insert_cpu( cpu );
300 
301  *dest = cpu;
302  return PAPI_OK;
303 }
#define PAPI_ENOMEM
Definition: fpapi.h:107
cpu
Definition: iozone.c:3872
return PAPI_OK
Definition: linux-nvml.c:458
hwd_context_t ** context
Definition: cpus.h:14
static void insert_cpu(CpuInfo_t *entry)
Definition: cpus.c:243
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
Definition: cpus.h:10
static CpuInfo_t * allocate_cpu(unsigned int cpu_num)
Definition: cpus.c:87
int papi_num_components
struct papi_vectors * _papi_hwd[]
ssize_t retval
Definition: libasync.c:338
static void free_cpu(CpuInfo_t **cpu)
Definition: cpus.c:190

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
static CpuInfo_t * _papi_hwi_lookup_cpu(unsigned int cpu_num)
Definition: cpus.c:29
#define CPUS_LOCK
Definition: papi_internal.h:92
int num_users
Definition: cpus.h:17
return PAPI_OK
Definition: linux-nvml.c:458
#define APIDBG(format, args...)
Definition: papi_debug.h:64
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
Definition: cpus.h:10
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
int _papi_hwi_initialize_cpu(CpuInfo_t **dest, unsigned int cpu_num)
Definition: cpus.c:275
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_shutdown_cpu ( CpuInfo_t cpu)

Definition at line 306 of file cpus.c.

307 {
308  APIDBG("Entry: cpu: %p, cpu_num: %d\n", cpu, cpu->cpu_num);
309 
310  free_cpu( &cpu );
311 
312  return PAPI_OK;
313 }
return PAPI_OK
Definition: linux-nvml.c:458
#define APIDBG(format, args...)
Definition: papi_debug.h:64
unsigned int cpu_num
Definition: cpus.h:12
static void free_cpu(CpuInfo_t **cpu)
Definition: cpus.c:190

Here is the call graph for this function:

Here is the caller graph for this function: