This version (2022/06/20 09:01) was approved by msiegel.
PROGRAM testpapi
include 'f77papi.h'
real real_time, cpu_timee, mflops
integer*8 fp_ins
integer ierr, res
C Call PAPIF_flops to get things started. This will initialize PAPI
C and start the counters running. Each of these calls return an
C error code in the 'ierr' parameter. See below for details on
C how to manage this.
call PAPIF_FLOPS(real_time, cpu_timee, fp_ins, mflops, ierr)
write (*,100) real_time*1000000, cpu_timee*1000000, fp_ins, mflops
C Do some computation
res=3+4
C Read the values in the counters and print them out. Any call to
C PAPIF_flops with fp_ins set to the value -1 will reinitialize
C all counters to zero. You might want to do this in order
C to individually time different portions of your application.
call PAPIF_FLOPS(real_time, cpu_timee, fp_ins, mflops, ierr)
write (*,100) real_time*1000000, cpu_timee*1000000, fp_ins, mflops
100 format(' Real time (ms) :', f15.4,
+ /' CPU time (ms) :', f15.4,
+ /'Floating point instructions :', i15,
+ /' MFLOPS :', f15.4)
END PROGRAM