Implementation of Dr Hook in the code
For the developers, in order DR_HOOK to run, each subroutine has to contain several further instructions :
USE YOMHOOK, ONLY : LHOOK, DR_HOOK
USE PARKIND1, ONLY : JPRB
REAL(KIND=JPRB) :: ZOOK_HANDLE
Then, just after declarations :
IF (LHOOK) CALL DR_HOOK(’name of the subroutine’,0, ZHOOK_HANDLE)
And, each time a subroutine is left (ie before each RETURN and before the END SUBROUTINE) :
IF (LHOOK) CALL DR_HOOK(’name of the subroutine’,1,ZHOOK_HANDLE)
Some scripts to automatically insert these instructions in .F90 or .F routines exist:
- get insert_drhook_F, insert_drhook_F.pl, insert_drhook_F90, insert_drhook_F90.pl
- also get src/Fortran90_stuff_interface.pm
- do ./insert_drhook.F90 file.F90 or ./insert_drhook.F file.F to insert Dr Hook instructions