Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
doku:papi_ll_fortran [2016/07/05 12:47] – ir | doku:papi_ll_fortran [2016/07/05 12:49] – [d] ir | ||
---|---|---|---|
Line 104: | Line 104: | ||
endif | endif | ||
+ | ====== d ====== | ||
+ | < | ||
+ | PROGRAM testpapi | ||
+ | include ' | ||
+ | integer check, evntst | ||
+ | integer*8 t0, t1, c0, c1, value | ||
+ | |||
+ | check = PAPI_NULL | ||
+ | C | ||
+ | C PAPI Initialization | ||
+ | C | ||
+ | check = PAPI_VER_CURRENT | ||
+ | call PAPIF_library_init(check) | ||
+ | if (check.ne.PAPI_VER_CURRENT) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | C | ||
+ | C PAPI Event Set Creation | ||
+ | C | ||
+ | evntst = PAPI_NULL | ||
+ | call PAPIF_create_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | C | ||
+ | C PAPI Specify a Particular Target Event to Analyze | ||
+ | C PAPI_TOT_CYC | ||
+ | C PAPI_FP_OPS | ||
+ | C PAPI_L1_DCM | ||
+ | C PAPI_L2_DCM | ||
+ | C for other events see | ||
+ | C / | ||
+ | C | ||
+ | call PAPIF_add_event(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | C | ||
+ | C PAPI Time Estimators Initialization | ||
+ | C | ||
+ | call PAPIF_get_real_usec(t0) | ||
+ | call PAPIF_get_real_cyc(c0) | ||
+ | C | ||
+ | C PAPI Counting Start | ||
+ | C | ||
+ | call PAPIF_start(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | |||
+ | C | ||
+ | C *** Here follows the original code section to be analyzed *** | ||
+ | C | ||
+ | |||
+ | C | ||
+ | C PAPI Counting Stop | ||
+ | C | ||
+ | call PAPIF_stop(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | C | ||
+ | C PAPI Time Estimators Stop | ||
+ | C | ||
+ | call PAPIF_get_real_usec(t1) | ||
+ | call PAPIF_get_real_cyc(c1) | ||
+ | C | ||
+ | C PAPI Results | ||
+ | C | ||
+ | write(6,' | ||
+ | write(6,' | ||
+ | write(6,' | ||
+ | C | ||
+ | C PAPI Free Event Set | ||
+ | C | ||
+ | call PAPIF_cleanup_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | call PAPIF_destroy_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | C | ||
+ | C PAPI Finalize | ||
+ | C | ||
+ | call PAPIF_shutdown(check) | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | | ||
+ | | ||
+ | stop | ||
+ | endif | ||
+ | |||
+ | END PROGRAM | ||