71{
80 int num_events2;
81 int num_events3;
85 long long max[3];
86 long long sum[3];
88
89
91
95 }
96
97
98
102 }
103
107 }
108
112 }
113
117
119
120
123
124 for (
i = 0;
i < 10;
i++ ) {
128
131
135
139
142
146
150
153
157 }
158
162
163 for ( j = 0; j < 3; j++ ) {
165 max[j] = sum[j] = 0;
166 }
167 for (
i = 0;
i < 10;
i++ ) {
168 for ( j = 0; j < 3; j++ ) {
171 if ( max[j] <
values[(
i * 3 ) + j][0] )
172 max[j] =
values[(
i * 3 ) + j][0];
173 sum[j] +=
values[(
i * 3 ) + j][0];
174 }
175 }
176
178 printf( "Test case 10: start, stop for derived event %s.\n",
180 printf( "--------------------------------------------------------\n" );
182 printf(
"Default domain is: %d (%s)\n",
tmp,
185 printf(
"Default granularity is: %d (%s)\n",
tmp,
187 printf(
"Using %d iterations of c += a*b\n",
ITERS );
188 printf( "Repeated 10 times\n" );
189 printf
190 ( "-------------------------------------------------------------------------\n" );
191
192
193
194
195
196
197
198
199
200
201 printf( "Test type : %12s%13s%13s\n", "min", "max", "sum" );
205 printf
206 ( "-------------------------------------------------------------------------\n" );
207 printf( "Verification:\n" );
208#if defined(sun) && defined(sparc)
209 printf(
TAB1,
"Sum 1 approximately equals sum 2 - sum 3 or",
210 ( sum[1] - sum[2] ) );
211#else
212 printf(
TAB1,
"Sum 1 approximately equals sum 2 + sum 3 or",
213 ( sum[1] + sum[2] ) );
214#endif
215 }
216
217 {
218 long long tmin, tmax;
219
220#if defined(sun) && defined(sparc)
221 tmax = (
long long ) ( sum[1] - sum[2] );
222#else
223 tmax = (
long long ) ( sum[1] + sum[2] );
224#endif
225
227 printf( "percent error: %f\n",
228 (( float ) abs( ( int ) ( tmax - sum[0] ) ) /
229 (float) sum[0] ) * 100.0 );
230 }
231 tmin = (
long long ) ( (
double ) tmax * 0.8 );
232 tmax = (
long long ) ( (
double ) tmax * 1.2 );
233 if ( sum[0] > tmax || sum[0] < tmin ) {
235 }
236 }
237
239
240 return 0;
241}
Get PAPI library or event set options.
initialize the PAPI library.
Query if PAPI event exists.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
void do_misses(int n, int bytes)
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
int add_test_events(int *number, int *mask, int allow_derived)
char * stringify_all_domains(int domains)
char * stringify_granularity(int granularity)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
long long ** allocate_test_space(int num_tests, int num_events)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
int remove_test_events(int *EventSet, int mask)