You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer/dev/diagnostic_tools.rst
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,18 +78,32 @@ The following macros are used to create timing regions in the Spheral C++ interf
78
78
79
79
- ``TIME_BEGIN("timer_name")`` and ``TIME_END("timer_name")`` create a region between the two different calls and use the string (in this case ``timer_name``) as the name.
80
80
81
+
It is not recommended to add timers to lower level functions. For example, functions that are called on a per SPH node basis should not have timers. If timers are desired for these types of functions, use advanced timers, denoted as ``ADV_TIME_BEGIN("timer_name")`` and ``ADV_TIME_END("timer_name")``. Advanced timers must be enabled through the python interface, as described below.
81
82
82
83
Adding Region Timers in Python
83
84
------------------------------
84
85
85
86
Region timers can be added inside the python code using the following function calls:
86
87
::
87
88
88
-
from SpheralUtilities import TimerMgr
89
+
from SpheralCompiledModules.SpheralUtilities import TimerMgr
90
+
if (not TimerMgr.is_started()):
91
+
TimerMgr.default_start("TestName.cali")
89
92
TimerMgr.timer_begin("timer_name")
90
93
some_function_call()
91
94
TimerMgr.timer_end("timer_name")
92
95
96
+
Similarly, advanced timers can be added through the python interface. They must be enabled through the python interface for any advanced timers to be included:
97
+
::
98
+
99
+
from SpheralCompiledModules.SpheralUtilities import TimerMgr
100
+
if (not TimerMgr.is_started()):
101
+
TimerMgr.default_start("TestName.cali")
102
+
TimerMgr.enable_advanced_timers() # Required for advanced timers to be included
103
+
TimerMgr.adv_timer_begin("timer_name")
104
+
some_function_call()
105
+
TimerMgr.adv_timer_end("timer_name")
106
+
93
107
.. note::
94
108
All timers must have both a start and end call. Otherwise, memory issues will occur.
95
109
@@ -129,7 +143,7 @@ Starting Caliper Manually
129
143
As mentioned above, the Caliper timing manager is normally configured and started in the ``commandLine()`` routine. However, Caliper can be directly configured and started through the python interface, if desired. This can be done by putting the following into the python file:
130
144
::
131
145
132
-
from SpheralUtilities import TimerMgr
146
+
from SpheralCompiledModules.SpheralUtilities import TimerMgr
0 commit comments