PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
PAPI_hw_info.c File Reference
Include dependency graph for PAPI_hw_info.c:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( )

Definition at line 12 of file PAPI_hw_info.c.

13 {
14  const PAPI_hw_info_t *hwinfo = NULL;
15  int retval;
16 
17  /***************************************************************************
18  * This part initializes the library and compares the version number of the*
19  * header file, to the version of the library, if these don't match then it *
20  * is likely that PAPI won't work correctly.If there is an error, retval *
21  * keeps track of the version number. *
22  ***************************************************************************/
23 
24 
26  {
27  printf("Library initialization error! \n");
28  exit(1);
29  }
30 
31  /* Get hardware info*/
32  if ((hwinfo = PAPI_get_hardware_info()) == NULL)
33  {
34  printf("PAPI_get_hardware_info error! \n");
35  exit(1);
36  }
37  /* when there is an error, PAPI_get_hardware_info returns NULL */
38 
39 
40  printf("%d CPU at %f Mhz.\n",hwinfo->totalcpus,hwinfo->mhz);
41  printf(" model string is %s \n", hwinfo->model_string);
42 
43  /* clean up */
44  PAPI_shutdown();
45 
46  exit(0);
47 
48 }
Hardware info structure.
Definition: papi.h:775
#define printf
Definition: papi_test.h:125
float mhz
Definition: papi.h:802
int PAPI_library_init(int version)
Definition: papi.c:495
void PAPI_shutdown(void)
Definition: papi.c:4357
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int totalcpus
Definition: papi.h:781
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:785
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
Definition: papi.c:6059
ssize_t retval
Definition: libasync.c:338
void exit()

Here is the call graph for this function: