Stopwatch to time parts of the code
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag |
Which stopwatch to act upon Action 1=start 2=stop |
||
| type(timer_list_type), | intent(inout) | :: | timers |
subroutine io_stopwatch_start(tag, timers) !===================================== !! Stopwatch to time parts of the code !===================================== use w90_types, only: timer_list_type, nmax implicit none ! arguments type(timer_list_type), intent(inout) :: timers character(len=*), intent(in) :: tag !! Which stopwatch to act upon !integer, intent(in) :: mode !! Action 1=start 2=stop ! local variables integer :: i real(kind=dp) :: t call cpu_time(t) do i = 1, timers%nnames if (timers%clocks(i)%label .eq. tag) then timers%clocks(i)%ptime = t timers%clocks(i)%ncalls = timers%clocks(i)%ncalls + 1 return end if end do if (.not. timers%overflow) then if (timers%nnames == nmax) then timers%overflow = .true. else timers%nnames = timers%nnames + 1 timers%clocks(timers%nnames)%label = tag timers%clocks(timers%nnames)%ctime = 0.0_dp timers%clocks(timers%nnames)%ptime = t timers%clocks(timers%nnames)%ncalls = 1 end if end if return end subroutine io_stopwatch_start