-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
@@ -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( |
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.
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(); |
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.
No need to go through all CPU to get the average information, it is already available in the global_cpu_info
.
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.
bors r+
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.
Pull request successfully merged into main. Build succeeded:
|
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.
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.