PAPI  5.3.0.0
perf_event_uncore_lib.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 
00005 #include "papi.h"
00006 
00007 char *get_uncore_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,"nhm_unc::UNC_CLK_UNHALTED",size);
00025             return event;
00026                 break;
00027        case 37:
00028        case 44: /* Westmere */
00029        case 47: /* Westmere EX */
00030                 strncpy(event,"wsm_unc::UNC_CLK_UNHALTED",size);
00031             return event;
00032                 break;
00033 
00034        case 62: /* Ivy Trail */
00035        case 45: /* SandyBridge EP */
00036                 strncpy(event,"snbep_unc_imc0::UNC_M_CLOCKTICKS",size);
00037             return event;
00038             break;
00039        case 42: /* SandyBridge */
00040                 strncpy(event,"snb_unc_cbo0::UNC_CLOCKTICKS",size);
00041             return event;
00042             break;
00043        case 58: /* IvyBridge */
00044                 strncpy(event,"ivb_unc_cbo0::UNC_CLOCKTICKS",size);
00045             return event;
00046             break;
00047      }
00048       }
00049       return NULL;
00050    }
00051    else if (hwinfo->vendor == PAPI_VENDOR_AMD) {
00052       if ( hwinfo->cpuid_family == 21) {
00053          /* For kernel 3.9 at least */
00054      strncpy(event,"DRAM_ACCESSES:ALL",size);
00055          return event;
00056       }
00057       return NULL;
00058    }
00059 
00060    return NULL;
00061 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines