PAPI 7.1.0.0
Loading...
Searching...
No Matches
PAPI_flops.c File Reference
Include dependency graph for PAPI_flops.c:

Go to the source code of this file.

Functions

int your_slow_code ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 24 of file PAPI_flops.c.

25{
26 float real_time, proc_time,mflops;
27 long long flpops;
28 float ireal_time, iproc_time, imflops;
29 long long iflpops;
30 int retval;
31
32 /***********************************************************************
33 * If PAPI_FP_OPS is a derived event in your platform, then your *
34 * platform must have at least three counters to support *
35 * PAPI_flops_rate, because PAPI needs one counter for cycles. So in *
36 * UltraSparcIII, even though the platform supports PAPI_FP_OPS, *
37 * UltraSparcIII only has two available hardware counters, and *
38 * PAPI_FP_OPS is a derived event that requires both of them, so *
39 * PAPI_flops_rate returns an error. *
40 ***********************************************************************/
41 if((retval=PAPI_flops_rate(PAPI_FP_OPS,&ireal_time,&iproc_time,&iflpops,&imflops)) < PAPI_OK)
42 {
43 printf("Could not initialise PAPI_flops \n");
44 printf("Your platform may not support floating point operation event.\n");
45 printf("retval: %d\n", retval);
46 exit(1);
47 }
48
50
51
52 if((retval=PAPI_flops_rate(PAPI_FP_OPS,&real_time, &proc_time, &flpops, &mflops))<PAPI_OK)
53 {
54 printf("retval: %d\n", retval);
55 exit(1);
56 }
57
58
59 printf("Real_time: %f Proc_time: %f flpops: %lld MFLOPS: %f\n",
60 real_time, proc_time,flpops,mflops);
61
62 exit(0);
63}
int your_slow_code()
Definition: PAPI_flops.c:65
Simplified call to get Mflops/s (floating point operation rate), real and processor time.
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_FP_OPS
Definition: f90papi.h:319
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:

◆ your_slow_code()

int your_slow_code ( )

Definition at line 65 of file PAPI_flops.c.

66{
67 int i;
68 double tmp=1.1;
69
70 for(i=1; i<2000; i++)
71 {
72 tmp=(tmp+100)/i;
73 }
74 return 0;
75}
double tmp
int i
Here is the caller graph for this function: