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

Implement events command for cgroup v1 stats #171

Merged
merged 12 commits into from
Jul 31, 2021
Merged

Conversation

Furisto
Copy link
Collaborator

@Furisto Furisto commented Jul 29, 2021

No description provided.

@Furisto Furisto linked an issue Jul 29, 2021 that may be closed by this pull request
@utam0k utam0k self-requested a review July 30, 2021 14:33
Comment on lines 169 to 172
let enabled = match hierarchy.trim() {
"1" => true,
_ => false,
};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let enabled = match hierarchy.trim() {
"1" => true,
_ => false,
};
let enabled = matches!(hierarchy.trim(), "1");

Comment on lines 141 to 145
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))?;
Copy link
Member

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

Suggested change
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()
};

Copy link
Member

@utam0k utam0k left a 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.

@Furisto
Copy link
Collaborator Author

Furisto commented Jul 31, 2021

@utam0k Updated with your suggestions.

Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

great!

@utam0k utam0k merged commit 62a1121 into youki-dev:main Jul 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implementation of events command
2 participants