record_edge Subroutine

private subroutine record_edge(parent, child, elapsed)

Updates the call tree edge statistics between two timers.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: parent

Index of the calling timer.

integer, intent(in) :: child

Index of the called timer.

real(kind=rk), intent(in) :: elapsed

Wall time spent in this call.


Source Code

   subroutine record_edge(parent, child, elapsed)
      integer, intent(in) :: parent
      integer, intent(in) :: child
      real(rk), intent(in) :: elapsed

      integer :: e

      do e = 1, nedges
         if (edges(e)%parent == parent .and. edges(e)%child == child) then
            edges(e)%calls = edges(e)%calls + 1
            edges(e)%total_time = edges(e)%total_time + elapsed
            return
         end if
      end do

      if (nedges >= MAX_EDGES) then
         write(error_unit,'(a)') 'profiler: MAX_EDGES exceeded'
         error stop 1
      end if

      nedges = nedges + 1
      edges(nedges)%parent = parent
      edges(nedges)%child = child
      edges(nedges)%calls = 1
      edges(nedges)%total_time = elapsed
   end subroutine record_edge