Created
March 9, 2023 06:14
-
-
Save b10n1k/f4810a2310ba793023761e82b30a57f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
const PAPI_hw_info_t *hwinfo = NULL; | |
int retval; | |
/*************************************************************************** | |
* This part initializes the library and compares the version number of the* | |
* header file, to the version of the library, if these don't match then it * | |
* is likely that PAPI won't work correctly.If there is an error, retval * | |
* keeps track of the version number. * | |
***************************************************************************/ | |
if((retval = PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT ) | |
{ | |
printf("Library initialization error! \n"); | |
exit(1); | |
} | |
/* Get hardware info*/ | |
if ((hwinfo = PAPI_get_hardware_info()) == NULL) | |
{ | |
printf("PAPI_get_hardware_info error! \n"); | |
exit(1); | |
} | |
/* when there is an error, PAPI_get_hardware_info returns NULL */ | |
printf("%d CPU at %f Mhz.\n",hwinfo->totalcpus,hwinfo->mhz); | |
printf(" model string is %s \n", hwinfo->model_string); | |
/* clean up */ | |
PAPI_shutdown(); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment