50{
59 int using_perfmon = 0;
60 int using_aix = 0;
61 int cid;
63 long long value;
64
65
67
71 }
72
76 }
77
79 if (cid>=0) using_perfmon = 1;
80
82 if (cid>=0) using_aix = 1;
83
84
85
86
87
89
91 if (!
quiet) printf(
"No events found\n");
92 test_skip(__FILE__,__LINE__,
"No events found",0);
93 }
94
96
98 sizeof ( char * ) );
99
103 }
104 else {
107 }
108 }
109
112 sizeof (
long long ) );
113 ovt = (
int * ) calloc( (
unsigned int )
num_events,
sizeof (
int ) );
114
115#if defined(linux)
116 {
117 char *
tmp = getenv(
"THRESHOLD" );
120 }
124
125 }
126 else {
129 }
130 }
131#else
133#endif
134
136
137
138 if (!
quiet) printf(
"Testing that the events all work with no overflow\n");
139
143 }
144
146
150 }
151
152
153
154
156
157
158 if (!
quiet) printf(
"Testing with overflow set on %s\n",
160
165 }
166
170 }
171
173
177 }
178
179
183 }
186 }
187
189
190 printf("\nResults in Matrix-view:\n");
191 printf( "Test Overflow on %d counters with %d events.\n",
193 printf( "-----------------------------------------------\n" );
194 printf(
"Threshold for overflow is: %d\n",
mythreshold );
195 printf( "Using %d iterations of c += a*b\n", num_flops );
196 printf( "-----------------------------------------------\n" );
197
198 printf( "Test type : " );
201 }
202 printf( "\n" );
204 printf(
"%-27s : ",
names[j] );
207 }
208 printf( "\n" );
209 }
210 printf( "Overflows : %16s", "" );
212 printf(
"%16d", ovt[
i] );
213 }
214 printf( "\n" );
215 printf( "-----------------------------------------------\n" );
216 }
217
218
219
221 printf("\nResults broken out for validation\n");
222 }
223
225
227 if (j==0) {
228 printf("Test results, no overflow:\n\t");
229 }
230 else {
231 printf(
"Overflow of event %d, %s\n\t",j-1,
names[j-1]);
232 }
236 }
237 else {
239 }
240 }
241 printf("\n");
242 if (j!=0) {
243 printf("\tOverflow should be %lld / %d = %lld\n",
247 printf("\tOverflow was %d\n",ovt[j-1]);
248 }
249 }
250 }
251
253
254
255
256
257
258
260
263
264 if ( using_perfmon )
266 "perfmon component handles overflow differently than perf_events",
267 1 );
268 else if ( using_aix )
270 "AIX (pmapi) component handles overflow differently than various other components",
271 1 );
272 else {
274 "Overflow value differs from expected %lld / %d should be %lld, we got %d",
277 ovt[j] );
279 }
280 }
281 }
282
286
290
291 free( ovt );
297
299
300 return 0;
301}
const char * names[NUM_EVENTS]
static const PAPI_hw_info_t * hw_info
Empty and destroy an EventSet.
Empty and destroy an EventSet.
Convert a numeric hardware event code to a name.
returns the component index for the named component
get information about the system hardware
initialize the PAPI library.
Set up an event set to begin registering overflows.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long mythreshold
char events[MAX_EVENTS][BUFSIZ]
static long long values[NUM_EVENTS]
void handler(int EventSet, void *address, long long overflow_vector, void *context)
int tests_quiet(int argc, char **argv)
int enum_add_native_events(int *num_events, int **evtcodes, int need_interrupts, int no_software_events, int cidx)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void test_warn(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char error_string[PAPI_MAX_STR_LEN]