releases the given timer env
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(timer_env_type), | POINTER | :: | timer_env |
the timer env to release |
SUBROUTINE timer_env_release(timer_env)
!! releases the given timer env
TYPE(timer_env_type), POINTER :: timer_env
!! the timer env to release
INTEGER :: i
TYPE(dict_i4tuple_callstat_item_type), &
DIMENSION(:), POINTER :: ct_items
TYPE(routine_stat_type), POINTER :: r_stat
IF (.NOT. ASSOCIATED(timer_env)) &
DBCSR_ABORT("timer_env_release: not associated")
IF (timer_env%ref_count < 0) &
DBCSR_ABORT("timer_env_release: negative ref_count")
timer_env%ref_count = timer_env%ref_count - 1
IF (timer_env%ref_count > 0) RETURN
! No more references left - let's tear down this timer_env...
DO i = 1, list_size(timer_env%routine_stats)
r_stat => list_get(timer_env%routine_stats, i)
DEALLOCATE (r_stat)
END DO
ct_items => dict_items(timer_env%callgraph)
DO i = 1, SIZE(ct_items)
DEALLOCATE (ct_items(i)%value)
END DO
DEALLOCATE (ct_items)
CALL dict_destroy(timer_env%routine_names)
CALL dict_destroy(timer_env%callgraph)
CALL list_destroy(timer_env%callstack)
CALL list_destroy(timer_env%routine_stats)
DEALLOCATE (timer_env)
END SUBROUTINE timer_env_release