Skip to content

Refactor duplicate CPU time calculation#381

Closed
VolodymyrBg wants to merge 1 commit intonexus-xyz:mainfrom
VolodymyrBg:bg
Closed

Refactor duplicate CPU time calculation#381
VolodymyrBg wants to merge 1 commit intonexus-xyz:mainfrom
VolodymyrBg:bg

Conversation

@VolodymyrBg
Copy link
Contributor

Describe your changes.

Extract duplicated time calculation logic in benchmarks/src/utils.rs into a reusable helper function.

Created a new helper function calculate_cpu_time to eliminate code duplication when calculating
CPU time from rusage structs. This function is now used in the phase_end function to calculate
both initial and final CPU times, making the code more maintainable and easier to understand.

This refactoring:

  • Reduces code duplication
  • Improves readability
  • Makes the code more maintainable
  • Preserves the exact same functionality

@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@VolodymyrBg
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@sjudson
Copy link
Contributor

sjudson commented Apr 1, 2025

Thanks a lot for the PR. Ultimately this is a minor aesthetic change in some benchmarking infrastructure, and as it doesn't fix a concrete issue or contribute new functionality, I'm going to pass on it.

@sjudson sjudson closed this Apr 1, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2025
@VolodymyrBg VolodymyrBg deleted the bg branch May 17, 2025 14:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants