17main(
int argc,
char **argv )
20 double rtime, ptime, mflips, mflops, ipc;
21 long long flips=0, flops=0, ins[2];
23 double rtime_start,rtime_end;
24 double ptime_start,ptime_end;
26 double rtime_classic,rtime_swapped;
27 double mflips_classic,mflips_swapped;
28 double mflops_classic,mflops_swapped;
29 double ipc_classic,ipc_swapped;
31 int quiet,event_added_flips,event_added_flops,event_added_ipc;
59 printf(
"\n----------------------------------\n" );
60 printf(
"PAPI_flips\n");
66 if (!
quiet) fprintf(
stderr,
"PAPI_FP_INS not available!\n");
73 if (event_added_flips) {
86 if (event_added_flips) {
90 rtime=rtime_end-rtime_start;
91 ptime=ptime_end-ptime_start;
96 printf(
"\nClassic\n");
97 printf(
"real time: %lf\n", rtime);
98 printf(
"process time: %lf\n", ptime);
99 printf(
"FP Instructions: %lld\n", flips);
100 printf(
"MFLIPS %lf\n", mflips);
102 mflips_classic=mflips;
109 if (event_added_flips) {
119 if (event_added_flips) {
123 rtime=rtime_end-rtime_start;
124 ptime=ptime_end-ptime_start;
129 printf(
"\nSwapped\n");
130 printf(
"real time: %f\n", rtime);
131 printf(
"process time: %f\n", ptime);
132 printf(
"FP Instructions: %lld\n", flips);
133 printf(
"MFLIPS %f\n", mflips);
135 mflips_swapped=mflips;
138 if (event_added_flips) {
142 "PAPI_remove_named_event",
retval );
151 printf(
"\n----------------------------------\n" );
152 printf(
"PAPI_flops\n");
158 if (!
quiet) fprintf(
stderr,
"PAPI_FP_OPS not available!\n");
165 if (event_added_flops) {
178 if (event_added_flops) {
182 rtime=rtime_end-rtime_start;
183 ptime=ptime_end-ptime_start;
188 printf(
"\nClassic\n");
189 printf(
"real time: %f\n", rtime);
190 printf(
"process time: %f\n", ptime);
191 printf(
"FP Operations: %lld\n", flops);
192 printf(
"MFLOPS %f\n", mflops);
194 mflops_classic=mflops;
201 if (event_added_flops) {
211 if (event_added_flops) {
215 rtime=rtime_end-rtime_start;
216 ptime=ptime_end-ptime_start;
221 printf(
"\nSwapped\n");
222 printf(
"real time: %f\n", rtime);
223 printf(
"process time: %f\n", ptime);
224 printf(
"FP Operations: %lld\n", flops);
225 printf(
"MFLOPS %f\n", mflops);
227 mflops_swapped=mflops;
230 if (event_added_flops) {
234 "PAPI_remove_named_event",
retval );
243 printf(
"\n----------------------------------\n" );
244 printf(
"PAPI_ipc\n");
250 if (!
quiet) fprintf(
stderr,
"PAPI_TOT_INS not available!\n");
257 if (event_added_ipc) {
261 if (!
quiet) fprintf(
stderr,
"PAPI_TOT_CYC not available!\n");
269 if (event_added_ipc) {
282 if (event_added_ipc) {
286 rtime=rtime_end-rtime_start;
287 ptime=ptime_end-ptime_start;
289 ipc=(double)ins[0]/(
double)ins[1];
292 printf(
"\nClassic\n");
293 printf(
"real time: %lf\n", rtime);
294 printf(
"process time: %lf\n", ptime);
295 printf(
"Instructions: %lld\n", ins[0]);
296 printf(
"Cycles: %lld\n", ins[1]);
297 printf(
"IPC %lf\n", ipc);
304 if (event_added_ipc) {
318 if (event_added_ipc) {
322 rtime=rtime_end-rtime_start;
323 ptime=ptime_end-ptime_start;
325 ipc=(double)ins[0]/(
double)ins[1];
328 printf(
"\nSwapped\n");
329 printf(
"real time: %lf\n", rtime);
330 printf(
"process time: %lf\n", ptime);
331 printf(
"Instructions: %lld\n", ins[0]);
332 printf(
"Cycles: %lld\n", ins[1]);
333 printf(
"IPC %lf\n", ipc);
340 if (event_added_flips) {
341 if (mflips_swapped<mflips_classic) {
343 "FLIPS should be better when swapped",0);
347 if (event_added_flops) {
348 if (mflops_swapped<mflops_classic) {
350 "FLOPS should be better when swapped",0);
354 if (event_added_ipc) {
355 if (ipc_swapped<ipc_classic) {
357 "IPC should be better when swapped",0);
361 if (rtime_swapped>rtime_classic) {
363 "time should be better when swapped",0);
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
get real time counter value in microseconds
get virtual time counter values in microseconds
initialize the PAPI library.
removes a named hardware event from a PAPI event set.
Reset the hardware event counts in an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
float flops_float_swapped_matrix_matrix_multiply(void)
float flops_float_matrix_matrix_multiply(void)
int flops_float_init_matrix(void)
Return codes and api definitions.
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)