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
We can even ask Scoped_Timer to append its name to current prefix.
Seems that we (almost?) always want a 'root' timer for a given scope.
NB: This works only if child timer is guaranteed to finish before the parent one. With Scoped_Timer, it will almost always be the case (unless we do some dirty tricks with pointers-to-timers). Simple Timer is more flexible, easier to break this nesting.
Also fix some timer names, e.g. for sdp2input
ScopedTimer now temporarily adds its name to Timers::prefix.
Example:
void f()
{
Timers timers(false);
Scoped_Timer root_timer(timers, "root"); // "root"
Scoped_Timer foo_timer(timers, "foo"); // "root.foo"
foo_timer.stop();
Scoped_Timer bar_timer(timers, "bar"); // "root.bar"
}
Currently one has to declare
Timer
name as"run.solve.some_function.other_function"
.We can automatically store current prefix in
Timers
(and push/pop prefixes using RAII).Then the code will look like
Inspired by
https://gitlab.com/bootstrapcollaboration/blocks_3d/-/commit/8717ba22dea47d7b13cff43ad02da83bff559b38#2ad9be1f8a0f77401abdb81cd016327598b6dd51
(but we can do it in a more elegant way)
The text was updated successfully, but these errors were encountered: