Open ranocha opened 3 years ago
Sounds like a good idea, but how could this be achieved? If we want to keep measuring all initialization routines, we'd have to allow to pass the custom timer in at multiple entry points to Trixi. OTOH, if we're only interested in timing the main loop, it would be sufficient to, e.g., have the SummaryCallback
accept a custom timer (or even a keyword argument to create and internally store a timer).
I think timing the initialization routines is good to have (we found more than one performance regression that way), so this seems to be a non-trivial question...
Right now, we reset_timer!(timer())
when we initialize the SummaryCallback
. Hence, we don't get timing reports of the initial mesh creation etc. In particular, we only get timing reports of everything that happens after the initialization of the SummaryCallback
. Hence, it should be possible to allow passing a custom timer there. On the other hand, we would have to pass something stored in an optional callback to everything else, so I'm not really sure whether that's a good idea at all...
This would give us more flexibility. Additionally, it's often good to avoid global mutable states, cf. https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f027338b0fab0f5078971fbe.