30{
34 double x = 1.1,
y, dtmp;
38#ifdef STARTSTOP
40#endif
48 int fails;
50
51
53
54
55 if ( argc > 1 ) {
56 if ( !strcmp( argv[1], "TESTS_QUIET" ) ) {
57 }
58 else {
59 sleep_time = atoi( argv[1] );
60 if ( sleep_time <= 0 )
62 }
63 }
64
74
78 }
79
80
82 printf( "\nAccuracy check of multiplexing routines.\n" );
83 printf( "Investigating the variance of multiplexed measurements.\n\n" );
84 }
85
89 }
90
91#ifdef MPX
95 "PAPI multiplex init fail\n",
retval );
96 }
97#endif
98
101 }
102
103#ifdef MPX
104
105
106
107
110 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
112 }
113
116 test_skip(__FILE__, __LINE__,
"Multiplex not supported", 1);
117 }
119 }
120#endif
121
122
124 for (
i = 0;
i < nevents;
i++ ) {
128 }
129 nevents--;
131 }
132 }
133
134
135 if ( nevents < 2 ) {
136 test_skip( __FILE__, __LINE__,
"Not enough events left...", 0 );
137 }
138
139
140
141
142
143
144 t2 = 10000 * 20 * nevents;
146 test_skip( __FILE__, __LINE__,
"This test takes too much time",
148 }
149
150
154
155
157 iters = iters * (
int ) (
t2 /
t1 );
158 }
159
160 else if (
t1 > 30e6 ) {
161 test_skip( __FILE__, __LINE__,
"This test takes too much time",
163 }
164
167 }
168
171
172#ifndef STARTSTOP
175#else
180#endif
181
183 printf(
"\nTest %d (of %d):\n",
i,
REPEATS );
184 }
185
190
192 printf( "\n(calculated independent of PAPI)\n" );
193 printf(
"\tOperations= %.1f Mflop",
y * 1e-6 );
194 printf( "\t(%g Mflop/s)\n\n",
195 (
y / (
double ) (
t2 -
t1 ) ) );
196 printf( "PAPI measurements:\n" );
197
198 for ( j = 0; j < nevents; j++ ) {
201 printf(
"%lld",
values[j] );
202 printf( "\n" );
203 }
204 printf( "\n" );
205 }
206
207
208 for ( j = 0; j < nevents; j++ ) {
209 dtmp = ( double )
values[j];
210 valsum[j] += dtmp;
211 valsample[j][
i - 1] = dtmp;
212 }
213 }
214
217
219 printf( "\n\nEstimated variance relative "
220 "to average counts:\n" );
221 for ( j = 0; j < nevents; j++ )
222 printf( " Event %.2d", j );
223 printf( "\n" );
224 }
225
226 fails = nevents;
227
228
229
230
231
232 for ( j = 0; j < nevents; j++ ) {
234 spread[j] = 0;
236 double diff = ( valsample[j][
i] - avg[j] );
237 spread[j] += diff * diff;
238 }
239 spread[j] = sqrt( spread[j] /
REPEATS ) / avg[j];
241 printf( "%9.2g ", spread[j] );
242
244 --fails;
245 }
246
248 --fails;
249 }
250 }
251
253 printf( "\n\n" );
254 for ( j = 0; j < nevents; j++ ) {
256 printf( "Event %.2d: mean=%10.0f, "
257 "sdev/mean=%7.2g nrpt=%2d -- %s\n",
258 j, avg[j], spread[j],
260 }
261 printf( "\n\n" );
262 }
263
264 if ( fails ) {
266 "Values outside threshold", fails );
267 }
268
270
271 return 0;
272}
static struct timeval t1 t2
add PAPI preset or native hardware event to an event set
Assign a component index to an existing but empty EventSet.
Create a new empty PAPI EventSet.
Get the event's name and description info.
get real time counter value in microseconds
initialize the PAPI library.
Initialize multiplex support in the PAPI library.
Read hardware counters from an event set.
Reset the hardware event counts in an event set.
Convert a standard event set to a multiplexed event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
double do_flops3(double x, int iters, int quiet)
char events[MAX_EVENTS][BUFSIZ]
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char short_descr[PAPI_MIN_STR_LEN]