-
-
Notifications
You must be signed in to change notification settings - Fork 504
Add disk io stats to EWW_DISK #1267
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
base: master
Are you sure you want to change the base?
Conversation
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.
this only works after running cargo update --recursive sysinfo, which alters the lockfile. otherwise, there are dependency resolution errors.
| // It is common for temperatures to report a non-numeric value. | ||
| // Tolerate it by serializing it as the string "null" | ||
| c.temperature().to_string().replace("NaN", "\"null\""), | ||
| c.temperature().unwrap_or(NAN).to_string().replace("NaN", "\"null\""), |
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.
this should leverage the power of the type system.
consider this, from #1217:
| c.temperature().unwrap_or(NAN).to_string().replace("NaN", "\"null\""), | |
| c.temperature().map_or_else(|| String::from("\"null\""), |temp| temp.to_string()), |
| "read": usage.read_bytes as f64 / elapsed.as_secs_f64(), | ||
| "written": usage.written_bytes as f64 / elapsed.as_secs_f64(), |
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.
it might be unclear which unit this is. consider documenting it
| let (ref mut last_refresh, ref mut disks) = &mut *DISKS.lock().unwrap(); | ||
| disks.refresh_specifics(true, DiskRefreshKind::everything()); |
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.
cleanup, nothing big
| let (ref mut last_refresh, ref mut disks) = &mut *DISKS.lock().unwrap(); | |
| disks.refresh_specifics(true, DiskRefreshKind::everything()); | |
| let (ref mut last_refresh, ref mut disks) = *DISKS.lock().unwrap(); | |
| disks.refresh(true); |
ea6f45b to
d5b1e67
Compare
|
Thanks for the review, I addressed your comments. |
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.
looks good now, thank you! <3
(only did some rough testing but should be fine)
Very cool project.
Description
This updates system_stats and exposes
readandwrittentoEWW_DISK, allowing to monitor disk io stats.Checklist
Please make sure you can check all the boxes that apply to this PR.
docs/content/maindirectory has been adjusted to reflect my changes.cargo fmtto automatically format all code before committing