Recursive function printing timing of the entry and its children
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_stack_entry), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | level |
recursive subroutine print_entry(this, level)
class(mimic_stack_entry), intent(inout) :: this
integer, intent(in) :: level
integer :: i
integer :: hierarchy_level
character(len=:), allocatable :: shift
character(len=95) :: print_str
hierarchy_level = level + 1
allocate(character(hierarchy_level + 1) :: shift)
shift = ""
do i = 1, hierarchy_level
shift = shift // "="
end do
shift = shift // "> "
write(print_str, '(A10,T10,A7,A20,A10,I6,A9,F8.4,A9,F8.4)') shift, "Name:", this%name, &
"# calls:", this%num_calls, "Max t.:", maxval(this%end_times - this%start_times), &
"Avg. t.:", sum(this%end_times - this%start_times) / this%num_calls
print '(A95)', adjustl(print_str)
if (associated(this%children)) then
do i = 1 , this%num_children
call this%children(i)%print(hierarchy_level)
end do
endif
end subroutine print_entry