|
PAPI
5.3.0.0
|
00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <string.h> 00004 00005 #include "papi.h" 00006 00007 char *get_offcore_event(char *event, int size) { 00008 00009 const PAPI_hw_info_t *hwinfo; 00010 00011 hwinfo = PAPI_get_hardware_info(); 00012 if ( hwinfo == NULL ) { 00013 return NULL; 00014 } 00015 00016 if (hwinfo->vendor == PAPI_VENDOR_INTEL) { 00017 00018 if ( hwinfo->cpuid_family == 6) { 00019 switch(hwinfo->cpuid_model) { 00020 case 26: 00021 case 30: 00022 case 31: /* Nehalem */ 00023 case 46: /* Nehalem EX */ 00024 strncpy(event,"OFFCORE_RESPONSE_0:DMND_DATA_RD:LOCAL_DRAM",size); 00025 return event; 00026 break; 00027 case 37: 00028 case 44: /* Westmere */ 00029 case 47: /* Westmere EX */ 00030 strncpy(event,"OFFCORE_RESPONSE_0:DMND_DATA_RD:LOCAL_DRAM",size); 00031 return event; 00032 break; 00033 00034 case 45: /* SandyBridge EP */ 00035 case 42: /* SandyBridge */ 00036 strncpy(event,"OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size); 00037 return event; 00038 break; 00039 00040 case 58: /* IvyBridge */ 00041 case 62: /* Ivy Trail */ 00042 strncpy(event,"OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size); 00043 return event; 00044 break; 00045 00046 } 00047 } 00048 return NULL; 00049 } 00050 else if (hwinfo->vendor == PAPI_VENDOR_AMD) { 00051 return NULL; 00052 } 00053 00054 return NULL; 00055 } 00056 00057 char *get_instructions_event(char *event, int size) { 00058 00059 const PAPI_hw_info_t *hwinfo; 00060 00061 hwinfo = PAPI_get_hardware_info(); 00062 if ( hwinfo == NULL ) { 00063 return NULL; 00064 } 00065 00066 if (hwinfo->vendor == PAPI_VENDOR_INTEL) { 00067 00068 if ( hwinfo->cpuid_family == 6) { 00069 strncpy(event,"INSTRUCTIONS_RETIRED",size); 00070 return event; 00071 } 00072 00073 if ( hwinfo->cpuid_family == 15) { 00074 strncpy(event,"INSTR_RETIRED:NBOGUSNTAG",size); 00075 return event; 00076 } 00077 00078 00079 return NULL; 00080 } 00081 else if (hwinfo->vendor == PAPI_VENDOR_AMD) { 00082 strncpy(event,"RETIRED_INSTRUCTIONS",size); 00083 return event; 00084 } 00085 00086 return NULL; 00087 }