PAPI_flops.c File Reference

Include dependency graph for PAPI_flops.c:

Go to the source code of this file.

Functions

 main ()
int your_slow_code ()

Function Documentation

main (  ) 

Definition at line 23 of file PAPI_flops.c.

00024 { 
00025   float real_time, proc_time,mflops;
00026   long long flpops;
00027   float ireal_time, iproc_time, imflops;
00028   long long iflpops;
00029   int retval;
00030 
00031   /***********************************************************************
00032    * if PAPI_FP_OPS is a derived event in your platform, then your       * 
00033    * platform must have at least three counters to support PAPI_flops,   *
00034    * because PAPI needs one counter to cycles. So in UltraSparcIII, even *
00035    * the platform supports PAPI_FP_OPS, but UltraSparcIII only has  two  *
00036    * available hardware counters and PAPI_FP_OPS is a derived event in   *
00037    * this platform, so PAPI_flops returns an error.                      *
00038    ***********************************************************************/
00039   if((retval=PAPI_flops(&ireal_time,&iproc_time,&iflpops,&imflops)) < PAPI_OK)
00040   { 
00041     printf("Could not initialise PAPI_flops \n");
00042     printf("Your platform may not support floating point operation event.\n"); 
00043     printf("retval: %d\n", retval);
00044     exit(1);
00045   }
00046 
00047   your_slow_code();
00048 
00049   
00050   if((retval=PAPI_flops( &real_time, &proc_time, &flpops, &mflops))<PAPI_OK)
00051   {    
00052     printf("retval: %d\n", retval);
00053     exit(1);
00054   }
00055 
00056 
00057   printf("Real_time: %f Proc_time: %f Total flpops: %lld MFLOPS: %f\n", 
00058          real_time, proc_time,flpops,mflops);
00059 
00060   exit(0);
00061 }

Here is the call graph for this function:

int your_slow_code (  ) 

Definition at line 63 of file PAPI_flops.c.

00064 {
00065   int i;
00066   double  tmp=1.1;
00067 
00068   for(i=1; i<2000; i++)
00069   { 
00070     tmp=(tmp+100)/i;
00071   }
00072   return 0;
00073 }


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1