da_tracing.f90
References to this file elsewhere.
1 module da_tracing
2
3 #ifdef DM_PARALLEL
4 use mpi, only : mpi_character
5 #endif
6
7 use da_control, only : num_procs, documentation_url, use_html, ierr, &
8 trace_pe, trace_memory, trace_unit, trace_csv_unit, &
9 trace_csv, myproc, comm, rootproc, trace_max_depth, &
10 trace_repeat_head, trace_repeat_body, trace_start_points, trace_all_pes
11 use da_par_util1, only : da_proc_sum_ints, da_proc_sum_real, da_proc_sum_int
12 use da_reporting, only : da_error
13
14 interface
15 ! c code
16 subroutine da_memory(memory_used)
17 integer, intent(out) :: memory_used
18 end subroutine da_memory
19 end interface
20
21 integer, parameter :: TraceIndentAmount = 2 ! default indent
22 integer, parameter :: MaxNoRoutines = 440 ! maxium number of subroutines
23 integer, parameter :: TraceNameLen = 31 ! Length of trace name
24
25 character (LEN=*), parameter :: &
26 pad = " "
27
28
29 ! Variables
30
31 integer :: TraceDepth ! Current depth of trace
32 integer :: NoRoutines ! Number of routines so far
33 integer :: NoCalls(MaxNoRoutines) ! Number of calls to each routine
34 integer :: NoCallsBody(MaxNoRoutines) ! Number of calls in body of each routine
35 integer :: CalledBy(MaxNoRoutines)
36 integer :: MaxHeap(MaxNoRoutines)
37 integer :: EntryHeap(MaxNoRoutines)
38 integer :: Pointer ! pointer to routine arrays in TIMER.
39 integer :: BaseElapsedTime
40 real :: BaseCPUTime
41 integer :: LastSpace
42
43 ! All CPU times in seconds
44
45 real :: CPUTimeStart(MaxNoRoutines)
46 real :: CPUTimeLocalStart
47 real :: CPUTime(MaxNoRoutines)
48 real :: CPUTimeLocal(MaxNoRoutines)
49 real :: CPUTimeThisCall(MaxNoRoutines)
50
51 ! All Elapsed times based on wall clock in seconds
52
53 real :: ElapsedTimeStart(MaxNoRoutines)
54 real :: ElapsedTimeLocalStart
55 real :: ElapsedTime(MaxNoRoutines)
56 real :: ElapsedTimeLocal(MaxNoRoutines)
57 real :: ElapsedTimeThisCall(MaxNoRoutines)
58
59 logical :: TraceActive = .false. ! Is it active in this routine?
60
61 character (LEN=TraceNameLen) :: TraceStartedBy ! Subroutine name
62 ! that activated trace
63 character (LEN=TraceNameLen) :: TimerNames(MaxNoRoutines) ! Subroutine names
64 character (LEN=TraceNameLen) :: TraceNames(MaxNoRoutines) ! for timing and tracing
65
66 logical :: trace_write = .false.
67
68
69 contains
70
71 #include "da_trace_init.inc"
72 #include "da_trace_entry.inc"
73 #include "da_trace.inc"
74 #include "da_trace_exit.inc"
75 #include "da_trace_int_sort.inc"
76 #include "da_trace_real_sort.inc"
77 #include "da_trace_report.inc"
78
79
80 end module da_tracing