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
more Timer functionality #152
Conversation
Travis tests are catching a timezone parsing issue that doesn't arise at NERSC or on my laptop. I'll investigate what the difference is, and back off on fancy date string parsing if needed. There might be some Travis churn as I sort this out. |
You're using |
No I wasn't using pytz (only vaguely aware of it...) Maybe for now I will just drop support for the fully generic Unix |
OK, ready for me to take a look? |
Yes, please. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine, but please note the comments. Most importantly, make sure self._print()
is used consistently throughout the Timer
class.
PS, please update the change log. |
OK to merge assuming tests pass. |
This PR adds several features that I wanted when actually putting it into use in desispec:
calculate_stats
(like Ted's example from CMB-land suggested in the original Timer PR add Timer class to standardize algorithm timing reports #151): combine multiple Timers into a report with min/max/mean/median of start/stop/duration.start
andstop
to set the time to use instead oftime.time()
, useful for recording timing of events that may have occurred before the timer was created, e.g. python startup and imports.Timer.cancel
to discard a named timer that had been started.I'll submit a companion desispec PR that uses these features, but this PR will need to be reviewed and merged before that one can be finalized.