fortime Module

This module provides a timer object for measuring elapsed time. It includes procedures for starting and stopping the timer, as well as calculating and printing the elapsed time in seconds.


Uses

    • kinds
  • module~~fortime~~UsesGraph module~fortime fortime kinds kinds module~fortime->kinds

Used by

  • module~~fortime~~UsedByGraph module~fortime fortime program~example1 example1 program~example1->module~fortime program~example2 example2 program~example2->module~fortime program~example3 example3 program~example3->module~fortime program~example4 example4 program~example4->module~fortime program~example5 example5 program~example5->module~fortime program~example6 example6 program~example6->module~fortime program~test1 test1 program~test1->module~fortime program~test10 test10 program~test10->module~fortime program~test11 test11 program~test11->module~fortime program~test12 test12 program~test12->module~fortime program~test13 test13 program~test13->module~fortime program~test14 test14 program~test14->module~fortime program~test15 test15 program~test15->module~fortime program~test16 test16 program~test16->module~fortime program~test17 test17 program~test17->module~fortime program~test18 test18 program~test18->module~fortime program~test19 test19 program~test19->module~fortime program~test2 test2 program~test2->module~fortime program~test20 test20 program~test20->module~fortime program~test21 test21 program~test21->module~fortime program~test22 test22 program~test22->module~fortime program~test23 test23 program~test23->module~fortime program~test24 test24 program~test24->module~fortime program~test25 test25 program~test25->module~fortime program~test26 test26 program~test26->module~fortime program~test27 test27 program~test27->module~fortime program~test28 test28 program~test28->module~fortime program~test29 test29 program~test29->module~fortime program~test3 test3 program~test3->module~fortime program~test30 test30 program~test30->module~fortime program~test4 test4 program~test4->module~fortime program~test5 test5 program~test5->module~fortime program~test6 test6 program~test6->module~fortime program~test7 test7 program~test7->module~fortime program~test8 test8 program~test8->module~fortime program~test9 test9 program~test9->module~fortime

Derived Types

type, public ::  timer

Components

Type Visibility Attributes Name Initial
real(kind=rk), public :: cpu_time
real(kind=rk), public :: elapsed_dtime
real(kind=rk), public :: elapsed_time
real(kind=rk), public :: mpi_time
real(kind=rk), public :: omp_time
integer, private :: clock_elapsed
integer, private :: clock_end
integer, private :: clock_rate
integer, private :: clock_start
real(kind=rk), private :: cpu_elapsed
real(kind=rk), private :: cpu_end
real(kind=rk), private :: cpu_start
real(kind=rk), private :: mpi_elapsed
real(kind=rk), private :: mpi_end
real(kind=rk), private :: mpi_start
real(kind=rk), private :: omp_elapsed
real(kind=rk), private :: omp_end
real(kind=rk), private :: omp_start
integer, private, dimension(8) :: values_elapsed
integer, private, dimension(8) :: values_end
integer, private, dimension(8) :: values_start

Type-Bound Procedures

procedure, public :: ctimer_start
procedure, public :: ctimer_stop
procedure, public :: ctimer_write
procedure, public :: dtimer_start
procedure, public :: dtimer_stop
procedure, public :: dtimer_write
procedure, public :: mtimer_start
procedure, public :: mtimer_stop
procedure, public :: mtimer_write
procedure, public :: otimer_start
procedure, public :: otimer_stop
procedure, public :: otimer_write
procedure, public :: timer_start
procedure, public :: timer_stop
procedure, public :: timer_write

Functions

private pure function to_seconds(values) result(seconds)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Arguments

Type IntentOptional Attributes Name
integer, intent(in), dimension(8) :: values

Return Value real(kind=rk)


Subroutines

private impure subroutine ctimer_start(this)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Starts the timer by recording the current CPU time value. This value is used to calculate the CPU time later.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

private impure subroutine ctimer_stop(this, nloops, message, print, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Stops the timer and calculates the CPU time. Optionally, it can print a message along with the CPU time.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

private impure subroutine ctimer_write(this, file_name)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Writes the CPU time to a file.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name

private impure subroutine dtimer_start(this)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Starts the timer by recording the current processor clock value. This value is used to calculate the elapsed time later.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

private impure subroutine dtimer_stop(this, nloops, message, print, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Stops the timer and calculates the elapsed time. Optionally, it can print a message along with the elapsed time.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

private impure subroutine dtimer_write(this, file_name)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Writes the elapsed time to a file.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name

private impure subroutine mtimer_start(this)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Starts the timer by recording the current MPI time value. This value is used to calculate the MPI time later.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

private impure subroutine mtimer_stop(this, nloops, message, print, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Stops the timer and calculates the MPI time. Optionally, it can print a message along with the MPI time.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

private impure subroutine mtimer_write(this, file_name)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Writes the MPI time to a file.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name

private impure subroutine otimer_start(this)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Starts the timer by recording the current OMP time value. This value is used to calculate the OMP time later.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

private impure subroutine otimer_stop(this, nloops, message, print, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Stops the timer and calculates the OMP time. Optionally, it can print a message along with the OMP time.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

private impure subroutine otimer_write(this, file_name)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Writes the OMP time to a file.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name

private impure subroutine print_time(time, message, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: time
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: color

private impure subroutine timer_start(this)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Starts the timer by recording the current processor clock value. This value is used to calculate the elapsed time later.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

private impure subroutine timer_stop(this, nloops, message, print, color)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Stops the timer and calculates the elapsed time. Optionally, it can print a message along with the elapsed time.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

private impure subroutine timer_write(this, file_name)

Author
Seyed Ali Ghasemi
License
BSD 3-Clause

Writes the elapsed time to a file.

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name