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

[Merged by Bors] - Update sysinfo and improve its use a bit #7826

Closed
wants to merge 2 commits into from

Conversation

GuillaumeGomez
Copy link
Contributor

I made a few internal fixes in sysinfo so why not be able to benefit from them? :)

I explain the other changes directly in diff comments.

@@ -69,23 +69,19 @@ pub mod internal {
mut sysinfo: Local<Option<System>>,
) {
if sysinfo.is_none() {
*sysinfo = Some(System::new_all());
*sysinfo = Some(System::new_with_specifics(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

System::new_all will retrieve a lot more information than what is being used here like all processes, network interfaces, etc... Since you only care about system memory and CPU usage, no need for everything else. Especially since you'll keep this one around! It should drop the memory impact by quite a lot.

// average
usage / cpus.len() as f32
};
let current_cpu_usage = sys.global_cpu_info().cpu_usage();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to go through all CPU to get the average information, it is already available in the global_cpu_info.

@mockersf mockersf added C-Dependencies A change to the crates that Bevy depends on A-Diagnostics Logging, crash handling, error reporting and performance analysis S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Feb 26, 2023
Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot pushed a commit that referenced this pull request Feb 27, 2023
I made a few internal fixes in sysinfo so why not be able to benefit from them? :)

I explain the other changes directly in diff comments.
@bors bors bot changed the title Update sysinfo and improve its use a bit [Merged by Bors] - Update sysinfo and improve its use a bit Feb 27, 2023
@bors bors bot closed this Feb 27, 2023
@GuillaumeGomez GuillaumeGomez deleted the update-sysinfo branch February 27, 2023 09:52
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
I made a few internal fixes in sysinfo so why not be able to benefit from them? :)

I explain the other changes directly in diff comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Dependencies A change to the crates that Bevy depends on S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants