Index: NEMO/branches/2020/dev_r14122_ENHANCE-14_smueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90
===================================================================
--- NEMO/branches/2020/dev_r14122_ENHANCE-14_smueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90	(revision 14126)
+++ NEMO/branches/2020/dev_r14122_ENHANCE-14_smueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90	(revision 14149)
@@ -67,4 +67,5 @@
    USE prtctl         ! Print control
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
+   USE timing, ONLY : timing_start, timing_stop   ! Timer
 
    IMPLICIT NONE
@@ -346,4 +347,5 @@
       !!--------------------------------------------------------------------
       !
+      IF( ln_timing ) CALL timing_start('zdf_osm')
       ibld(:,:)   = 0     ; imld(:,:)  = 0
       zrad0(:,:)  = 0._wp ; zradh(:,:) = 0._wp ; zradav(:,:)    = 0._wp ; zustar(:,:)    = 0._wp
@@ -1251,4 +1253,5 @@
 
       END IF
+      IF( ln_timing ) CALL timing_stop('zdf_osm')
 
 CONTAINS
@@ -1280,4 +1283,5 @@
       REAL(wp), PARAMETER :: rn_vispyc_shr = 0.15
 
+      IF( ln_timing ) CALL timing_start('zdf_osm_dv')
       DO_2D( 0, 0, 0, 0 )
           IF ( lconv(ji,jj) ) THEN
@@ -1383,4 +1387,5 @@
           !
        END_2D
+      IF( ln_timing ) CALL timing_stop('zdf_osm_dv')
 
   END SUBROUTINE zdf_osm_diffusivity_viscosity
@@ -1421,4 +1426,5 @@
      REAL, PARAMETER :: zrot=0._wp  ! dummy rotation rate of surface stress.
 
+     IF( ln_timing ) CALL timing_start('zdf_osm_os')
 ! Determins stability and set flag lconv
      DO_2D( 0, 0, 0, 0 )
@@ -1531,4 +1537,5 @@
       ENDIF    ! lshear
      END_2D
+     IF( ln_timing ) CALL timing_stop('zdf_osm_os')
    END SUBROUTINE zdf_osm_osbl_state
 
@@ -1558,4 +1565,5 @@
 
 
+        IF( ln_timing ) CALL timing_start('zdf_osm_va')
         zt   = 0._wp
         zs   = 0._wp
@@ -1600,4 +1608,5 @@
          ENDIF
         END_2D
+     IF( ln_timing ) CALL timing_stop('zdf_osm_va')
    END SUBROUTINE zdf_osm_vertical_average
 
@@ -1619,4 +1628,5 @@
         REAL(wp) :: ztemp
 
+        IF( ln_timing ) CALL timing_start('zdf_osm_vr')
         DO_2D( 0, 0, 0, 0 )
            ztemp = zu(ji,jj)
@@ -1627,4 +1637,5 @@
            zdv(ji,jj) = zdv(ji,jj) * zsin_w(ji,jj) - ztemp * zsin_w(ji,jj)
         END_2D
+        IF( ln_timing ) CALL timing_stop('zdf_osm_vr')
     END SUBROUTINE zdf_osm_velocity_rotation
 
@@ -1651,4 +1662,5 @@
       REAL(wp)                      :: zpe_mle_ref, zwb_ent, zdbdz_mle_int
 
+      IF( ln_timing ) CALL timing_start('zdf_osm_osf')
       znd_param(:,:) = 0._wp
 
@@ -1732,4 +1744,5 @@
           ENDIF  ! lconv
         END_2D
+        IF( ln_timing ) CALL timing_stop('zdf_osm_osf')
     END SUBROUTINE zdf_osm_osbl_state_fk
 
@@ -1751,4 +1764,5 @@
 
 
+     IF( ln_timing ) CALL timing_start('zdf_osm_eg')
      DO_2D( 0, 0, 0, 0 )
         IF ( jbase(ji,jj)+1 < mbkt(ji,jj) ) THEN
@@ -1768,4 +1782,5 @@
         END IF
      END_2D
+     IF( ln_timing ) CALL timing_stop('zdf_osm_eg')
     END SUBROUTINE zdf_osm_external_gradients
 
@@ -1781,4 +1796,5 @@
      REAL(wp), PARAMETER :: zgamma_b = 2.25, zzeta_sh = 0.15
 
+     IF( ln_timing ) CALL timing_start('zdf_osm_pscp')
      DO_2D( 0, 0, 0, 0 )
         IF ( ibld(ji,jj) + jp_ext(ji,jj) < mbkt(ji,jj) ) THEN
@@ -1847,4 +1863,5 @@
         ENDIF      ! IF ( ibld(ji,jj) < mbkt(ji,jj) )
      END_2D
+     IF( ln_timing ) CALL timing_stop('zdf_osm_pscp')
 
     END SUBROUTINE zdf_osm_pycnocline_scalar_profiles
@@ -1866,4 +1883,5 @@
       REAL(wp) :: zzeta_v = 0.45
       !
+      IF( ln_timing ) CALL timing_start('zdf_osm_pshp')
       DO_2D( 0, 0, 0, 0 )
          !
@@ -1906,4 +1924,5 @@
          END IF      ! IF ( ibld(ji,jj) + ibld_ext < mbkt(ji,jj) )
       END_2D
+      IF( ln_timing ) CALL timing_stop('zdf_osm_pshp')
     END SUBROUTINE zdf_osm_pycnocline_shear_profiles
 
@@ -1929,4 +1948,5 @@
     REAL, PARAMETER :: a_ddh = 2.5, a_ddh_2 = 3.5 ! also in pycnocline_depth
 
+    IF( ln_timing ) CALL timing_start('zdf_osm_cd')
   DO_2D( 0, 0, 0, 0 )
 
@@ -2050,4 +2070,5 @@
       ENDIF ! lshear
   END_2D
+    IF( ln_timing ) CALL timing_stop('zdf_osm_cd')
     END SUBROUTINE zdf_osm_calculate_dhdt
 
@@ -2072,4 +2093,5 @@
     REAL(wp) :: zthermal, zbeta
 
+     IF( ln_timing ) CALL timing_start('zdf_osm_th')
      DO_2D( 0, 0, 0, 0 )
         IF ( ibld(ji,jj) - imld(ji,jj) > 1 ) THEN
@@ -2152,4 +2174,5 @@
         zhbl(ji,jj) = gdepw(ji,jj,ibld(ji,jj),Kmm)
      END_2D
+     IF( ln_timing ) CALL timing_stop('zdf_osm_th')
 
     END SUBROUTINE zdf_osm_timestep_hbl
@@ -2176,4 +2199,5 @@
       REAL, PARAMETER :: a_ddh_2 = 3.5 ! also in pycnocline_depth
 
+      IF( ln_timing ) CALL timing_start('zdf_osm_pt')
     DO_2D( 0, 0, 0, 0 )
 
@@ -2287,4 +2311,5 @@
       zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj)
     END_2D
+      IF( ln_timing ) CALL timing_stop('zdf_osm_pt')
 
     END SUBROUTINE zdf_osm_pycnocline_thickness
@@ -2317,4 +2342,5 @@
 !!----------------------------------------------------------------------
       !
+      IF( ln_timing ) CALL timing_start('zdf_osm_zhg')
       !                                      !==  MLD used for MLE  ==!
 
@@ -2378,4 +2404,5 @@
              & + dbdx_mle(ji-1,jj) * dbdx_mle(ji-1,jj) + dbdy_mle(ji,jj-1) * dbdy_mle(ji,jj-1) ) )
       END_2D
+      IF( ln_timing ) CALL timing_stop('zdf_osm_zhg')
 
  END SUBROUTINE zdf_osm_zmld_horizontal_gradients
@@ -2398,4 +2425,5 @@
       REAL(wp) ::  ztmp, zdbdz, zdtdz, zdsdz, zthermal,zbeta, zbuoy, zdb_mle
 
+      IF( ln_timing ) CALL timing_start('zdf_osm_mp')
    ! Calculate vertical buoyancy, heat and salinity fluxes due to MLE.
 
@@ -2439,4 +2467,5 @@
          zhmle(ji,jj) = gdepw(ji,jj, mld_prof(ji,jj),Kmm)
       END_2D
+      IF( ln_timing ) CALL timing_stop('zdf_osm_mp')
 END SUBROUTINE zdf_osm_mle_parameters
 
@@ -2471,4 +2500,5 @@
      !!----------------------------------------------------------------------
      !
+     IF( ln_timing ) CALL timing_start('zdf_osm_init')
      READ  ( numnam_ref, namzdf_osm, IOSTAT = ios, ERR = 901)
 901  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_osm in reference namelist' )
@@ -2672,4 +2702,5 @@
      ghamv(:,:,:) = 0.
      !
+     IF( ln_timing ) CALL timing_stop('zdf_osm_init')
    END SUBROUTINE zdf_osm_init
 
@@ -2698,4 +2729,5 @@
      !!----------------------------------------------------------------------
      !
+     IF( ln_timing ) CALL timing_start('osm_rst')
      !!-----------------------------------------------------------------------------
      ! If READ/WRITE Flag is 'READ', try to get hbl from restart file. If successful then return
@@ -2780,4 +2812,5 @@
      ww(:,:,:) = 0._wp
      WRITE(numout,*) ' ===>>>> :  wn not in restart file, set to zero initially'
+     IF( ln_timing ) CALL timing_stop('osm_rst')
    END SUBROUTINE osm_rst
 
@@ -2799,4 +2832,5 @@
       INTEGER :: ji, jj, jk
       !
+      IF( ln_timing ) CALL timing_start('tra_osm')
       IF( kt == nit000 ) THEN
          IF( ntile == 0 .OR. ntile == 1 ) THEN                    ! Do only on the first tile
@@ -2836,4 +2870,5 @@
       ENDIF
       !
+      IF( ln_timing ) CALL timing_stop('tra_osm')
    END SUBROUTINE tra_osm
 
@@ -2852,5 +2887,7 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) :: kt
+      IF( ln_timing ) CALL timing_start('trc_osm')
       WRITE(*,*) 'trc_osm: Not written yet', kt
+      IF( ln_timing ) CALL timing_stop('trc_osm')
    END SUBROUTINE trc_osm
 
@@ -2872,4 +2909,5 @@
       !!----------------------------------------------------------------------
       !
+      IF( ln_timing ) CALL timing_start('dyn_osm')
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -2890,4 +2928,5 @@
       ! code for saving tracer trends removed
       !
+      IF( ln_timing ) CALL timing_stop('dyn_osm')
    END SUBROUTINE dyn_osm
 
