-
Notifications
You must be signed in to change notification settings - Fork 346
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
fix(libcgroups): report CPU throttling stats in 'libcgroups::v2' #2524
Conversation
Signed-off-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
It seems that the Should we use |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2524 +/- ##
==========================================
+ Coverage 65.87% 65.91% +0.03%
==========================================
Files 133 133
Lines 16868 16873 +5
==========================================
+ Hits 11112 11121 +9
+ Misses 5756 5752 -4 |
Thanks for your PR!
I prefer to use it if possible. |
Signed-off-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
✅No problem! It turns out that the following macro appears at least 3 times in the code base. This macro makes it easier to extract fields from the parsed flat keyed data. Should we move this common logic to macro_rules! get {
($name: expr => $field1:ident.$field2:ident) => {
stats.$field1.$field2 =
*stats_table
.get($name)
.ok_or_else(|| V2CpuStatsError::MissingField {
field: $name,
path: stats_path.clone(),
})?;
};
} |
Go ahead 👍 But please send out a new PR about it. When you will do it, please set me as a reviewer. |
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.
LGTM
fix #2513
This pull request adds logic to read relevant fields from
cpu.stat
file to populate theCpuThrottling
struct for thestats
method oflibcgroups::v2::Cpu
.Reference: https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v2.rst
CPU Interface Files ~~~~~~~~~~~~~~~~~~~ All time durations are in microseconds. cpu.stat A read-only flat-keyed file. This file exists whether the controller is enabled or not. It always reports the following three stats: - usage_usec - user_usec - system_usec and the following five when the controller is enabled: - nr_periods - nr_throttled - throttled_usec - nr_bursts - burst_usec