Deprecate cpu-utilization and add cpu-utilization-pct for multi-core support - #1515
Deprecate cpu-utilization and add cpu-utilization-pct for multi-core support#1515charanjith-anet wants to merge 3 commits into
Conversation
The cpu-utilization leaf in openconfig-procmon used oc-types:percentage (uint8, range 0-100), which cannot represent CPU utilization on multi-core systems where per-process values can exceed 100%. Change the type to uint16 to accommodate this.
There was a problem hiding this comment.
Code Review
This pull request updates the openconfig-procmon.yang module to version 0.5.0, changing the cpu-utilization leaf type from oc-types:percentage to uint16 to support multi-core systems where CPU utilization can exceed 100%. The review feedback recommends using uint32 instead of uint16 to prevent potential overflow on systems with more than 655 cores, and adding an explicit units "percentage" statement to maintain self-documentation.
|
OC operator review Jul 14: Can you please look at having cpu-utilization-uint32 as an alternative ? |
Agreed - widening a type is probably safe in most scenarios but any strict handling or hybrid env running different versions of the modeling complicates matters that we honestly cannot probably fully know, especially as time goes on and adoption increases. As far as the proposal, I agree this is a gap in the current definition that needs to be fixed. |
Add a new cpu-utilization-pct leaf with uint32 type to support multi-core systems where per-process CPU utilization can exceed 100%. Deprecate the existing cpu-utilization leaf to preserve backward compatibility.
|
OC review : July 28th moving ahead. |
|
OC operator's review August 4th. Taking it further to merge. |
|
/gcbrun |
|
No major YANG version changes in commit ca2738d |
| } | ||
|
|
||
| leaf cpu-utilization-pct { | ||
| type uint32; |
There was a problem hiding this comment.
One additional thought that I think would be helpful here for various renderings is make this a typedef, take the type, units, description verbatim - call the typedef something like oc-types:multi-core-percentage then we get a descriptive type and reuse as this will probably come up in other future uses
Summary
cpu-utilizationleaf (oc-types:percentage, uint8 range 0-100)cpu-utilization-pctleaf withuint32type to support multi-core systems where per-process CPU utilization can exceed 100%Background
The
cpu-utilizationleaf under/system/processes/process/stateis backed by/proc/PID/statin Linux-based implementations. On multi-core systems, a process using multiple cores can report CPU utilization exceeding 100% (up to 100% per core). The previous typeoc-types:percentagerestricts values to 0-100, which is insufficient.A new leaf is added instead of modifying the existing type to preserve backward compatibility — downstream consumers may have strict type handling or run mixed model versions.
Test plan
pyangcpu-utilization