F.1 Timer Class Code Listing

The main documentation of the Timer Class contains additional explanation of this code listing.

!
! Author: Michael L. Hall
!         P.O. Box 1663, MS-D413, LANL
!         Los Alamos, NM 87545
!         ph: 505-665-4312
!         email: Hall@LANL.gov
! 
! Created on: 07/09/01
! CVS Info:   $Id: timer.F90,v 1.20 2007/02/21 21:28:28 hall Exp $

module Caesar_Timer_Class

  ! Global use associations.

  use Caesar_Mathematics_Module
  use Caesar_Data_Structures_Module
  use Caesar_Numbers_Module, only: zero

  ! Start up with everything untyped and private.

  implicit none
  private

  ! Public procedures.

  public :: Initialize, Finalize, Valid_State, Initialized
  public :: Arithmetic_Mean, Average, Count, Geometric_Mean, Get_CPU_Time, &
            Get_Wall_Clock_Time, Harmonic_Mean, Julian_Day, Maximum, Mean, &
            Minimum, Name, Output, Reset, Standard_Deviation, Start, Stop, &
            Sum, Total, Totally_Positive

  interface Initialize
    module procedure Initialize_Timer
  end interface

  interface Finalize
    module procedure Finalize_Timer
  end interface

  interface Valid_State
    module procedure Valid_State_Timer
  end interface

  interface Initialized
    module procedure Initialized_Timer
  end interface

  interface Average
    module procedure Get_Arithmetic_Mean_Timer
  end interface          

  interface Get_CPU_Time
    module procedure Get_CPU_Time
  end interface

  interface Get_Wall_Clock_Time
    module procedure Get_Wall_Clock_Time
  end interface

  fortext([Value],[Arithmetic_Mean Count Geometric_Mean Harmonic_Mean 
                   Maximum Minimum Name Standard_Deviation Sum 
                   Totally_Positive],[
    interface Value
      module procedure expand(Get_Value_Timer)
    end interface
  ])
                         
  interface Mean     
    module procedure Get_Arithmetic_Mean_Timer
  end interface          

  interface Output
    module procedure Output_Timer
  end interface

  interface Reset
    module procedure Reset_Timer
  end interface

  interface Start
    module procedure Start_Timer
  end interface

  interface Stop
    module procedure Stop_Timer
  end interface
                         
  interface Total    
    module procedure Get_Sum_Timer
  end interface

  ! Public type definitions.

  public :: Time_type, Timer_type

  type Time_type

    ! Starting time.

    type(real) :: Start

    ! Timing statistics.

    type(Statistics_type) :: Statistics

  end type Time_type

  type Timer_type

    ! Initialization status.

    type(logical,1) :: Initialized

    ! Two times to track.

    type(Time_type) :: CPU_Time, Wall_Clock_Time

    ! The name for this timer.

    type(character,80) :: Name

    ! True when the timer is active.

    type(logical) :: Running

  end type Timer_type

contains

The Timer Class contains the following routines which are listed in separate sections:

* Initialize_Timer
* Finalize_Timer
* Valid_State_Timer
* Initialized_Timer
* Get Value Timer
* Get_CPU_Time
* Get_Wall_Clock_Time
* Julian_Day
* Output_Timer
* Reset_Timer
* Start_Timer
* Stop_Timer

end module Caesar_Timer_Class



Subsections
Michael L. Hall