PAPI 7.1.0.0
Loading...
Searching...
No Matches
event_name_lib.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5#include "papi.h"
6
7char *get_offcore_event(char *event, int size) {
8
9 const PAPI_hw_info_t *hwinfo;
10
11 hwinfo = PAPI_get_hardware_info();
12 if ( hwinfo == NULL ) {
13 return NULL;
14 }
15
16 if (hwinfo->vendor == PAPI_VENDOR_INTEL) {
17
18 if ( hwinfo->cpuid_family == 6) {
19 switch(hwinfo->cpuid_model) {
20
21 case 26:
22 case 30:
23 case 31: /* Nehalem */
24 case 46: /* Nehalem EX */
25 strncpy(event,
26 "OFFCORE_RESPONSE_0:DMND_DATA_RD:LOCAL_DRAM",size);
27 return event;
28 break;
29
30 case 37:
31 case 44: /* Westmere */
32 case 47: /* Westmere EX */
33 strncpy(event,
34 "OFFCORE_RESPONSE_0:DMND_DATA_RD:LOCAL_DRAM",size);
35 return event;
36 break;
37
38 case 45: /* SandyBridge EP */
39 case 42: /* SandyBridge */
40 strncpy(event,
41 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
42 return event;
43 break;
44
45 case 58: /* IvyBridge */
46 case 62: /* Ivy Trail */
47 strncpy(event,
48 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
49 return event;
50 break;
51
52 case 60: /* Haswell */
53 case 69:
54 case 70:
55 case 63: /* Haswell EP */
56 strncpy(event,
57 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
58 return event;
59 break;
60
61 case 61: /* Broadwell */
62 case 71:
63 case 86:
64 case 79: /* Broadwell EP */
65 strncpy(event,
66 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
67 return event;
68 break;
69
70 case 78: /* Skylake */
71 case 94:
72 case 85: /* Skylake-X */
73 strncpy(event,
74 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
75 return event;
76 break;
77
78 case 142: /* Kabylake */
79 case 158:
80 strncpy(event,
81 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
82 return event;
83 break;
84
85 case 87: /* Knights Landing */
86 strncpy(event,
87 "OFFCORE_RESPONSE_0:DMND_DATA_RD:ANY_RESPONSE",size);
88 return event;
89 break;
90
91 }
92 }
93 return NULL;
94 }
95 else if (hwinfo->vendor == PAPI_VENDOR_AMD) {
96 return NULL;
97 }
98
99 return NULL;
100}
101
102char *get_instructions_event(char *event, int size) {
103
104 const PAPI_hw_info_t *hwinfo;
105
106 hwinfo = PAPI_get_hardware_info();
107 if ( hwinfo == NULL ) {
108 return NULL;
109 }
110
111 if (hwinfo->vendor == PAPI_VENDOR_INTEL) {
112
113 if ( hwinfo->cpuid_family == 6) {
114 strncpy(event,"INSTRUCTIONS_RETIRED",size);
115 return event;
116 }
117
118 if ( hwinfo->cpuid_family == 15) {
119 strncpy(event,"INSTR_RETIRED:NBOGUSNTAG",size);
120 return event;
121 }
122
123 return NULL;
124 }
125 else if (hwinfo->vendor == PAPI_VENDOR_AMD) {
126 strncpy(event,"RETIRED_INSTRUCTIONS",size);
127 return event;
128 }
129
130 return NULL;
131}
132
133char *get_invalid_event_name(char *event, int size) {
134
135 const PAPI_hw_info_t *hwinfo;
136
137 hwinfo = PAPI_get_hardware_info();
138 if ( hwinfo == NULL ) {
139 return NULL;
140 }
141
142 if (hwinfo->vendor == PAPI_VENDOR_INTEL) {
143
144 if ( hwinfo->cpuid_family == 6) {
145 switch(hwinfo->cpuid_model) {
146
147 case 78: /* Skylake */
148 case 94:
149 case 85: /* Skylake-X */
150 strncpy(event,
151 "DTLB_LOAD_MISSES:MISS_CAUSES_A_WALK,DTLB_STORE_MISSES:MISS_CAUSES_A_WALK:u=1",size);
152 return event;
153 break;
154
155 }
156 }
157 return NULL;
158 }
159 else if (hwinfo->vendor == PAPI_VENDOR_AMD) {
160 return NULL;
161 }
162
163 return NULL;
164}
165
get information about the system hardware
char * get_offcore_event(char *event, int size)
Definition: event_name_lib.c:7
char * get_invalid_event_name(char *event, int size)
char * get_instructions_event(char *event, int size)
#define PAPI_VENDOR_INTEL
Definition: f90papi.h:275
#define PAPI_VENDOR_AMD
Definition: f90papi.h:230
Return codes and api definitions.
Hardware info structure.
Definition: papi.h:774
int cpuid_family
Definition: papi.h:786
int cpuid_model
Definition: papi.h:787
int vendor
Definition: papi.h:781