33 main(
int argc,
char **argv )
36 float rtime, ptime, mflips, mflops, ipc, epc;
37 long long flpins, flpops, ins, ref, core, evt;
39 double mflips_classic,mflips_swapped;
40 double mflops_classic,mflops_swapped;
41 double ipc_classic,ipc_swapped;
42 double epc_classic,epc_swapped;
57 printf(
"\n----------------------------------\n" );
58 printf(
"PAPI_flips\n");
65 test_skip(__FILE__,__LINE__,
"Could not add event",0);
70 printf(
"real time: %f\n", rtime);
71 printf(
"process time: %f\n", ptime);
72 printf(
"FP Instructions: %lld\n", flpins);
73 printf(
"MFLIPS %f\n", mflips);
77 if ((rtime!=0) || (ptime!=0) || (flpins!=0) || (mflips!=0)) {
78 test_fail(__FILE__,__LINE__,
"Not initialized to zero",0);
87 printf(
"\nClassic\n");
88 printf(
"real time: %f\n", rtime);
89 printf(
"process time: %f\n", ptime);
90 printf(
"FP Instructions: %lld\n", flpins);
91 printf(
"MFLIPS %f\n", mflips);
93 mflips_classic=mflips;
101 printf(
"\nSwapped\n");
102 printf(
"real time: %f\n", rtime);
103 printf(
"process time: %f\n", ptime);
104 printf(
"FP Instructions: %lld\n", flpins);
105 printf(
"MFLIPS %f\n", mflips);
107 mflips_swapped=mflips;
120 printf(
"\n----------------------------------\n" );
121 printf(
"PAPI_flops\n");
130 printf(
"\nStart\n");
131 printf(
"real time: %f\n", rtime);
132 printf(
"process time: %f\n", ptime);
133 printf(
"FP Operations: %lld\n", flpops);
134 printf(
"MFLOPS %f\n", mflops);
138 if ((rtime!=0) || (ptime!=0) || (flpops!=0) || (mflops!=0)) {
139 test_fail(__FILE__,__LINE__,
"Not initialized to zero",0);
148 printf(
"\nClassic\n");
149 printf(
"real time: %f\n", rtime);
150 printf(
"process time: %f\n", ptime);
151 printf(
"FP Operations: %lld\n", flpops);
152 printf(
"MFLOPS %f\n", mflops);
154 mflops_classic=mflops;
162 printf(
"\nSwapped\n");
163 printf(
"real time: %f\n", rtime);
164 printf(
"process time: %f\n", ptime);
165 printf(
"FP Operations: %lld\n", flpops);
166 printf(
"MFLOPS %f\n", mflops);
168 mflops_swapped=mflops;
181 printf(
"\n----------------------------------\n" );
182 printf(
"PAPI_ipc\n");
190 printf(
"\nStart\n");
191 printf(
"real time: %f\n", rtime);
192 printf(
"process time: %f\n", ptime);
193 printf(
"Instructions: %lld\n", ins);
194 printf(
"IPC %f\n", ipc);
198 if ((rtime!=0) || (ptime!=0) || (ins!=0) || (ipc!=0)) {
199 test_fail(__FILE__,__LINE__,
"Not initialized to zero",0);
208 printf(
"\nClassic\n");
209 printf(
"real time: %f\n", rtime);
210 printf(
"process time: %f\n", ptime);
211 printf(
"Instructions: %lld\n", ins);
212 printf(
"IPC %f\n", ipc);
222 printf(
"\nSwapped\n");
223 printf(
"real time: %f\n", rtime);
224 printf(
"process time: %f\n", ptime);
225 printf(
"Instructions: %lld\n", ins);
226 printf(
"IPC %f\n", ipc);
241 printf(
"\n----------------------------------\n" );
242 printf(
"PAPI_epc\n");
251 if (!
quiet) printf(
"Can't find %s; Using PAPI_TOT_INS\n", argv[1]);
254 if (!
quiet) printf(
"Using event %s\n", argv[1]);
259 if (
PAPI_epc(event, &rtime, &ptime, &ref, &core, &evt, &epc) !=
PAPI_OK )
263 printf(
"\nStart\n");
264 printf(
"real time: %f\n", rtime);
265 printf(
"process time: %f\n", ptime);
266 printf(
"Ref Cycles: %lld\n", ref);
267 printf(
"Core Cycles: %lld\n", core);
268 printf(
"Events: %lld\n", evt);
269 printf(
"EPC: %f\n", epc);
273 if ((rtime!=0) || (ptime!=0) || (ref!=0) || (core!=0)
274 || (evt!=0) || (epc!=0)) {
275 test_fail(__FILE__,__LINE__,
"Not initialized to zero",0);
280 if (
PAPI_epc(event, &rtime, &ptime, &ref, &core, &evt, &epc) !=
PAPI_OK )
284 printf(
"\nClassic\n");
285 printf(
"real time: %f\n", rtime);
286 printf(
"process time: %f\n", ptime);
287 printf(
"Ref Cycles: %lld\n", ref);
288 printf(
"Core Cycles: %lld\n", core);
289 printf(
"Events: %lld\n", evt);
290 printf(
"EPC: %f\n", epc);
296 if (
PAPI_epc(event, &rtime, &ptime, &ref, &core, &evt, &epc) !=
PAPI_OK ) {
301 printf(
"\nSwapped\n");
302 printf(
"real time: %f\n", rtime);
303 printf(
"process time: %f\n", ptime);
304 printf(
"Ref Cycles: %lld\n", ref);
305 printf(
"Core Cycles: %lld\n", core);
306 printf(
"Events: %lld\n", evt);
307 printf(
"EPC: %f\n", epc);
317 printf(
"\n----------------------------------\n" );
321 if (mflips_swapped<mflips_classic) {
322 test_fail(__FILE__,__LINE__,
"FLIPS should be better when swapped",0);
324 if (mflops_swapped<mflops_classic) {
325 test_fail(__FILE__,__LINE__,
"FLOPS should be better when swapped",0);
327 if (ipc_swapped<ipc_classic) {
328 test_fail(__FILE__,__LINE__,
"IPC should be better when swapped",0);
330 if (epc_swapped<epc_classic) {
331 test_fail(__FILE__,__LINE__,
"EPC should be better when swapped",0);
void test_pass(const char *filename)
int PAPI_ipc(float *rtime, float *ptime, long long *ins, float *ipc)
int PAPI_flops(float *rtime, float *ptime, long long *flpops, float *mflops)
int PAPI_event_name_to_code(const char *in, int *out)
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_flips(float *rtime, float *ptime, long long *flpins, float *mflips)
int PAPI_epc(int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc)
float flops_float_swapped_matrix_matrix_multiply(void)
int PAPI_stop_counters(long long *values, int array_len)
int flops_float_init_matrix(void)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int main(int argc, char **argv)
void PAPI_perror(const char *msg)
float flops_float_matrix_matrix_multiply(void)