-
Notifications
You must be signed in to change notification settings - Fork 355
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
Implement events command for cgroup v1 stats #171
Conversation
src/cgroups/v1/memory.rs
Outdated
let enabled = match hierarchy.trim() { | ||
"1" => true, | ||
_ => false, | ||
}; |
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.
let enabled = match hierarchy.trim() { | |
"1" => true, | |
_ => false, | |
}; | |
let enabled = matches!(hierarchy.trim(), "1"); |
src/cgroups/v1/blkio.rs
Outdated
let mut stats = BlkioStats::default(); | ||
|
||
stats.service_bytes = | ||
Self::parse_blkio_file(&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICE_BYTES))?; | ||
stats.serviced = Self::parse_blkio_file(&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICED))?; |
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.
https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
let mut stats = BlkioStats::default(); | |
stats.service_bytes = | |
Self::parse_blkio_file(&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICE_BYTES))?; | |
stats.serviced = Self::parse_blkio_file(&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICED))?; | |
let stats = BlkioStats { | |
service_bytes: Self::parse_blkio_file( | |
&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICE_BYTES), | |
)?, | |
serviced: Self::parse_blkio_file(&cgroup_path.join(BLKIO_THROTTLE_IO_SERVICED))?, | |
..Default::default() | |
}; |
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 seems to be mostly fine, but I made a few comments.
@utam0k Updated with your suggestions. |
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.
great!
No description provided.