Skip to content
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

Report CPU Time alongside Wall Time #275

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

elenatanasoiu
Copy link
Contributor

@elenatanasoiu elenatanasoiu commented Dec 10, 2024

We'd like to be able to quantify CPU time consumed while executing the
candidate and control blocks during science experiments.

Changes include:

  • Added cpu_time attribute to Scientist::Observation.
  • Refactored initialization to capture both start/end times for wall
    time and CPU time.
  • Updated tests to include CPU work so we can verify we're
    recording CPU time correctly.

This allows us to track cpu time more precisely when making improvements.

We'd like to be able to quantify CPU time consumed while executing
the candidate and control blocks during science experiments.

Changes include:
- Added `cpu_time` attribute to `Scientist::Observation`.
- Refactored initialization to capture both start/end times for wall
time and CPU time.
- Updated tests to include CPU-intensive work so we can verify we're
recording CPU time correctly.

This allows us to track cpu time more precisely when making improvements.
Copy link

@madelineleclair madelineleclair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from github/feature-management-reviewers

This supports both the old version (single value) and new version (hash-based).

I've added back the tests from the old version to check that the code stills works
when we provide a single value.

I've also adapted the README a bit to explain both versions.
Copy link
Member

@zerowidth zerowidth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Question about the doc, I could go either way, what do you think?

README.md Outdated
If you're writing tests that depend on specific timing values, you can provide canned durations using the `fabricate_durations_for_testing_purposes` method, and Scientist will report these in `Scientist::Observation#duration` and `Scientist::Observation#cpu_time` instead of the actual execution times.
If you're writing tests that depend on specific timing values, you can provide canned durations using the `fabricate_durations_for_testing_purposes` method. This can be done using either the old version (single value) or the new version (hash-based) to include both duration and cpu_time.

##### Old version (Single Value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine leaving this section of the doc out -- the API has changed but the old version still works, but we may as well encourage the updated version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hokey doke! I've removed the "Old version" section and rephrased.

@zerowidth zerowidth merged commit fdd09d0 into github:main Dec 16, 2024
6 checks passed
@elenatanasoiu
Copy link
Contributor Author

Thanks for your help @zerowidth 🙇‍♀️ !

@elenatanasoiu elenatanasoiu deleted the elena/add-cpu-time branch December 16, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants