Commit 5068d92
Adjust CPU usage based on host cgroup usage
gVisor approximates CPU usage because it doesn't have full control over
task scheduling. Scheduling is handled by the Golang's scheduler and the
host kernel. This can cause gVisor to overeatimate CPU usage, especially
in cases where there are multiple processes executing or cgroups restricts
usage to fractions of a CPU.
In order to report CPU usage more accurately, we use the sandbox's cgroup
CPU usage to estimate how much CPU each container is using.
PiperOrigin-RevId: 8290020531 parent 605acfd commit 5068d92
2 files changed
+32
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | | - | |
187 | | - | |
| 190 | + | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
192 | | - | |
193 | 196 | | |
194 | | - | |
195 | | - | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
| 577 | + | |
| 578 | + | |
581 | 579 | | |
582 | 580 | | |
583 | 581 | | |
| |||
1708 | 1706 | | |
1709 | 1707 | | |
1710 | 1708 | | |
1711 | | - | |
| 1709 | + | |
1712 | 1710 | | |
1713 | | - | |
| 1711 | + | |
1714 | 1712 | | |
1715 | 1713 | | |
1716 | 1714 | | |
| |||
0 commit comments