PAPI  5.0.1.0
PAPI_flips.c File Reference
Include dependency graph for PAPI_flips.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_flips.c.

{ 
  float real_time, proc_time,mflips;
  long long flpins;
  float ireal_time, iproc_time, imflips;
  long long iflpins;
  int retval;

  /***********************************************************************
   * if PAPI_FP_INS is a derived event in your platform, then your       * 
   * platform must have at least three counters to support PAPI_flips,   *
   * because PAPI needs one counter to cycles. So in UltraSparcIII, even *
   * the platform supports PAPI_FP_INS, but UltraSparcIII only have two  *
   * available hardware counters and PAPI_FP_INS is a derived event in   *
   * this platform, so PAPI_flops returns an error.                      *
   ***********************************************************************/

  if((retval=PAPI_flips(&ireal_time,&iproc_time,&iflpins,&imflips)) < PAPI_OK)
  { 
    printf("Could not initialise PAPI_flips \n");
    printf("Your platform may not support floating point instruction event.\n");    printf("retval: %d\n", retval);
    exit(1);
  }

  your_slow_code();

  
  if((retval=PAPI_flips( &real_time, &proc_time, &flpins, &mflips))<PAPI_OK)
  {    
    printf("retval: %d\n", retval);
    exit(1);
  }


  printf("Real_time: %f Proc_time: %f Total flpins: %lld MFLIPS: %f\n", 
         real_time, proc_time,flpins,mflips);

  exit(0);
}

Here is the call graph for this function:

int your_slow_code ( )

Definition at line 63 of file PAPI_flips.c.

{
  int i;
  double  tmp=1.1;

  for(i=1; i<2000; i++)
  { 
    tmp=(tmp+100)/i;
  }
  return 0;
}

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines