timer_utils
moment_kinetics.timer_utils — Module
Utilities for timing functions or blocks of code
sourcemoment_kinetics.timer_utils.global_timer — Constant
Global object used to collect timings of various parts of the code
sourcemoment_kinetics.timer_utils.timer_names_all_ranks_dfns — Constant
Nested SortedDict with the names of all timers that have been created on any MPI rank and added to the dfns output file.
sourcemoment_kinetics.timer_utils.timer_names_all_ranks_moments — Constant
Nested SortedDict with the names of all timers that have been created on any MPI rank and added to the moments output file.
sourcemoment_kinetics.timer_utils.format_global_timer — Method
format_global_timer(; show_output=false, threshold=1.0e-3, truncate_output=true,
top_level=nothing)Manipulate a copy of the global_timer, to remove some things to reduce the clutter when it is printed.
By default the resulting TimerOutput is not displayed. Pass show_output=true to display the resulting TimerOutput in the terminal.
By default, the output is truncated, removing deeply nested timers and timers with very little time. To include all timers, pass truncate_output=false. The threshold for dropping timers is if their time is less than threshold times the total time.
top_level can be passed a Tuple of Strings to select a (possibly nested) sub-timer of global_timer to be formatted, instead of global_timer.
By default, returns a string showing the contents of the TimerOutput. When show_output=true is passed, just returns the empty string.
moment_kinetics.timer_utils.timeit_debug_enabled — Method
timeit_debug_enabled()@timeit_debug uses a function defined in the enclosing module called timeit_debug_enabled() to decide whether to include debug timers (included if this function returns true, or not - with zero overhead - if it returns false).
To control the debug timers in moment_kinetics we define this function once, in timer_utils, and import it from there into any other modules that use @timeit_debug.
To activate debug timers, edit this function so that it returns true.