      SUBROUTINE PRNTIM(DTOTTIM, PTOTTIM, PHTOTTIM, NBSTEP, DELT, STIM1,
     +               DOPHYS, DODYN,   NENDJ, NENDJD)
 
C     * APR 07/98 - B.DENIS - FIRST VERSION.  
C
C     * PRINT OUT TIMIMGS. 4 TIMINGS ARE PRINTED OUT.
C     * 1- THE TOTAL CPU TIME SPENT FOR THE WHOLE JOB.
C     * 2- THE TOTAL CPU TIME SPENT FOR THE "DYNAMICS LOOP"
C     * 3- THE TOTAL CPU TIME SPENT FOR THE "PHYSICS LOOP"
C     * 4- THE TOTAL CPU TIME SPENT FOR THE "PHYSICS ROUTINE"
C
C     * FOR 2-4 ITEMS, TIMIMGS ARE ALSO BROKEN DOWN BY LATITUDE GROUPS.
C
C
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)

      INTEGER NENDJ, NENDJD, NBSTEP
C
      REAL TIMJOB,DELT
      DOUBLE PRECISION STIM, STIM1,STIM2
C
      REAL DTOTTIM(NENDJD)
      REAL PTOTTIM (NENDJ), PHTOTTIM(NENDJ)
C
      LOGICAL DOPHYS, DODYN
C     * ---------------------------------------------------------------
C
C     * PRINT "WALLCLOCK" TIME INFO FOR THE WHOLE JOB
    
      CALL ETIME(STIM2)
      STIM=STIM2-STIM1
      WRITE(6,6000) STIM
      AVGTIM= STIM/FLOAT(NBSTEP)        
      WRITE(6,6002) NBSTEP, AVGTIM
      AVGTIM = AVGTIM*86400./DELT
      WRITE(6,6004) AVGTIM

C     * PRINT "CPU" TIME INFO FOR THE WHOLE JOB

      CALL CLOCK(TIMJOB)
      WRITE(6,6010) TIMJOB
      AVGTIM = TIMJOB/FLOAT(NBSTEP)
      WRITE(6,6012) NBSTEP, AVGTIM
      AVGTIM = AVGTIM*86400./DELT
      WRITE(6,6014) AVGTIM

C     * FOR DYNAMICS LOOP (CORExxD:
C     
      IF(DODYN) THEN
         GDTOT=0.0
         DO J=1,NENDJD
            GDTOT= GDTOT + DTOTTIM(J) 
         ENDDO
         WRITE(6,6020) GDTOT
         WRITE(6,6022)
         WRITE(6,6024) (J,  DTOTTIM(J), DTOTTIM(J)/FLOAT(NBSTEP), 
     1                       100*DTOTTIM(J)/GDTOT,J=1,NENDJD)
      ENDIF
      
C     * FOR PHYSICS LOOP (CORExxD).
      
      IF(DOPHYS) THEN
         GPTOT =0.0
         DO J=1,NENDJ
            GPTOT  =  GPTOT +  PTOTTIM(J) 
         ENDDO
         WRITE(6,6030) GPTOT
         WRITE(6,6032)
         WRITE(6,6034) (J,  PTOTTIM(J), PTOTTIM(J)/FLOAT(NBSTEP), 
     1                    100*PTOTTIM(J)/GPTOT,J=1,NENDJ)
      ENDIF
      
C     * FOR  PHYSICS SUBROUTINE (PHYSICxx):
      
      IF(DOPHYS) THEN
         GPHTOT=0.0
         DO J=1,NENDJ
            GPHTOT = GPHTOT + PHTOTTIM(J)
         ENDDO
         WRITE(6,6040) GPHTOT
         WRITE(6,6042)
         WRITE(6,6044) (J,  PHTOTTIM(J), PHTOTTIM(J)/FLOAT(NBSTEP), 
     1                      100*PHTOTTIM(J)/GPHTOT,J=1,NENDJ )
      ENDIF

C     
C     ---------------------------------------------------------------
 6000 FORMAT(/,' TOTAL WALLCLOCK TIME USED TO EXECUTE THIS JOB (SEC):'
     +         ,F10.2)
 6002 FORMAT(' AVERAGE WALLCLOCK TIME PER TIMESTEP (NBSTEP=',I5,') :'
     +         ,F10.2)
 6004 FORMAT(' AVERAGE WALLCLOCK TIME PER DAY                     :'
     +         ,F10.2)
C
 6010 FORMAT(/,' TOTAL CPU TIME USED TO EXECUTE THIS JOB (SEC):',F10.2)
 6012 FORMAT(' AVERAGE CPU TIME PER TIMESTEP (NBSTEP=',I5,') :', F10.2)
 6014 FORMAT(' AVERAGE CPU TIME PER DAY                     :', F10.2)
C      
 6020 FORMAT(/,' TOTAL CPU TIME IN "DYNAMICS LOOP" (SEC) :', F10.2,/)
 6022 FORMAT(24X,'CPU TIME     AVG BY STEP             %')
 6024 FORMAT('  LAT GROUP(',I2,'): ',3F15.2)
C      
 6030 FORMAT(/,' TOTAL CPU TIME IN "PHYSICS  LOOP" (SEC) :', F10.2 /)
 6032 FORMAT(24X,'CPU TIME     AVG BY STEP             %')
 6034 FORMAT('  LAT GROUP(',I2,'): ',3F15.2)
C      
 6040 FORMAT(/,' TOTAL CPU TIME IN "PHYSICS ROUTINE" (SEC) :', F10.2,/)
 6042 FORMAT(24X,'CPU TIME     AVG BY STEP             %')
 6044 FORMAT('  LAT GROUP(',I2,'): ',3F15.2)
      RETURN
      END
