As of the 4.7 kernel, the cpustats field returned from libcontainer contains values for every possible cpu (including nonexistent ones). The extra values are all 0s. If we assume that hotplug events won't happen, we can get a more accurage cpu count by using runtime.NumCPU and then ignoring any values beyond that. |
||
---|---|---|
.. | ||
testdata | ||
helpers_test.go | ||
helpers.go |