-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add globally registered timers #135
Conversation
I don't think your example will work:
You would need to retrieve the timer in |
You're right. I've simplified the example to get the timer locally rather than setting a const. That's what I've been doing in my code anyway. We could add something similar to Edit: I tried adding a register function and realized that we would run into weird situations when the timer gets disabled if there are multiple copies floating around. It's probably best to only use a timer from |
I think this is ok (still needs some docs in the README). But this shouldn't really be used by packages since it basically puts everything in a shared namespace and if packages use it you might get accidental collisions. This is why I am feeling this is perhaps not the ideal solution to the problem. |
Yeah, this solution is meant for really limited use. I basically want to keep a human-readable trace of the runtimes of a couple components within our system on live runs. As is stands, the current solution good enough for the situation I need it for which is essentially a couple named default timers. If you have any ideas for alternate solutions to the problem I'd be happy to try them out! I'll add some documentation in the meantime. |
Why not just define the named timers as global variables? |
Presumably because you want to share them between multiple packages so one uses TimerOutputs.jl as a "storage" because all packages have access to it. |
We have a system that uses ~300 packages and want to keep track of live runtimes for a few components in around 5 of them for business reasons. Our POC uses the default timer but that is pretty dangerous. |
The docs have been updated for a while now if anyone has time for re-review. |
Codecov Report
@@ Coverage Diff @@
## master #135 +/- ##
==========================================
- Coverage 93.10% 88.23% -4.87%
==========================================
Files 4 5 +1
Lines 377 408 +31
==========================================
+ Hits 351 360 +9
- Misses 26 48 +22
Continue to review full report at Codecov.
|
One could perhaps suggest in the docs or even enforce that those timers are fetched using the package UUID? |
I think it is fine to warn. |
Closes #134.
Adds
get_timer
function to register and retrieve timers. This allows users to access timers for different workflows without having to pass them through intermediate packages.Example use case: