Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=*), | public, | parameter, dimension(2) | :: | CITE_PAPERS | = | ["J. Chem. Theory Comput. 2019, 15, 6, 3810–3823 ", "J. Chem. Theory Comput. 2019, 15, 10, 5601–5613"] | |
type(mimic_timer), | public, | save | :: | timer | |||
type(mimic_stack_entry), | public, | pointer, save | :: | current_entry | => | null() |
Initializer of a stack entry
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | Name of a function |
||
integer, | intent(in) | :: | hash | Hash ID |
||
integer, | intent(in) | :: | num_calls | Current number of calls |
||
type(mimic_stack_entry), | pointer | :: | parent | Parent entry |
Class representing the call stack entry
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | private, | allocatable | :: | name | Name of the entry (procedure) |
||
type(mimic_stack_entry), | private, | dimension(:), pointer | :: | children | => | null() | Nested entries (internal calls) |
type(mimic_stack_entry), | private, | pointer | :: | parent | => | null() | Pointer to the parent entry |
integer, | private | :: | num_children | = | 0 | Number of nested entries |
|
real(kind=dp), | private, | dimension(:), allocatable | :: | start_times | Array of times of start of the procedure |
||
real(kind=dp), | private, | dimension(:), allocatable | :: | end_times | Array of times of finish of the procedure |
||
integer, | private | :: | num_calls | Total number of calls |
|||
integer, | private | :: | hash | Hash identifier |
public function init_entry(name, hash, num_calls, parent) | Initializer of a stack entry |
procedure, public :: increment => increment_entry | |
procedure, public :: print => print_entry |
Timer class storing all function calls
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(mimic_stack_entry), | private, | dimension(:), pointer | :: | entries | List of top-level function calls |
||
integer, | private | :: | num_entries | = | 0 | Number of entries |
procedure, private :: start => start_timer | |
procedure, private :: stop => stop_timer | |
procedure, private :: print => print_timings |
Get current time
Calculate a hash of the string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
Start a timer for a given function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_timer), | intent(inout), | target | :: | this | ||
type(mimic_stack_entry), | intent(inout), | pointer | :: | parent | pointer to parent stack entry |
|
character(len=*), | intent(in) | :: | name | name of the procedure |
Pointer to a created stack entry
Add a function call to registry
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mimic_stack_entry), | intent(inout), | dimension(:), pointer | :: | entries | ||
integer, | intent(inout) | :: | num_entries | |||
integer, | intent(in) | :: | hash | |||
character(len=*), | intent(in) | :: | name | |||
type(mimic_stack_entry), | intent(in), | pointer | :: | parent |
Initializer of a stack entry
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | Name of a function |
||
integer, | intent(in) | :: | hash | Hash ID |
||
integer, | intent(in) | :: | num_calls | Current number of calls |
||
type(mimic_stack_entry), | pointer | :: | parent | Parent entry |
Recursive function looking for the entry in array by hash
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mimic_stack_entry), | intent(in), | dimension(:), pointer | :: | entries | List of entries to search |
|
integer | :: | num_entries | Number of entries |
|||
integer, | intent(in) | :: | hash | Hash ID of the function |
pointer to a found entry or null pointer
Writes a welcome message to the standard output together with the list of papers to cite.
Start timing the routine with a given name. This procedure will start tracking the execution time of a given function in a call stack tree. Subsequent calls to this function will create additional entries in the call stack that are going to be shown as children of the original routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | Name of the function to time. |
Stop timing last routine. This procedure will record the finishing time of the routine that was timed the last. Moreover, it will move one level up in the call stack hierarchy.
Print the call stack with timing information.
Stop a timer for a given function (invalidates the pointer)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_timer), | intent(inout), | target | :: | this | ||
type(mimic_stack_entry), | intent(inout), | pointer | :: | entry | Function timing of which is currently measured |
Print measured timings of function calls
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_timer), | intent(inout) | :: | this |
Add new start time to the entry
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mimic_stack_entry), | intent(inout) | :: | this |
Recursive function making a deep copy of stack_entry
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mimic_stack_entry), | intent(in) | :: | src | Source entry |
||
type(mimic_stack_entry), | intent(out), | target | :: | dst | Result |
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 |