PAPI 7.1.0.0
Loading...
Searching...
No Matches
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

◆ main()

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 */
45
46 exit(0);
47
48}
get information about the system hardware
initialize the PAPI library.
Finish using PAPI and free all related resources.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
Hardware info structure.
Definition: papi.h:774
float mhz
Definition: papi.h:801
int totalcpus
Definition: papi.h:780
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:784
int retval
Definition: zero_fork.c:53