Simple(-minded) example to use PAPI from Fortran.
We spent far too long putting this together, lacking a better description of the API than can be found in PAPI's doxygen. This is very basic, but should help you as a starting point.
Of course you are much better off using tools like Score-P/Scalasca, Likwid, or perf to instrument/measure your code. This basic approach shown here uses low-level PAPI calls should you long for more fine grained control.