2 ms·
See also my comment for how to determine this: https://news.ycombinator.com/item?id=38185277 https://news.ycombinator.com/item?id=38185277
by telotortium 2y ago
See also my comment for how to determine this: https://news.ycombinator.com/item?id=38185277 https://news.ycombinator.com/item?id=38185277
- Daviey 2y agoThat's good, but i'd prefer not to assume perl is there. Perhaps something like this untested POSIX shell might be better? if [ -e /sys/fs/cgroup/cpu/cpu.cfs_quota_us ] && [ -e /sys/fs/cgroup/cpu/cpu.cfs_period_us ]; then read -r quota < /sys/fs/cgroup/cpu/cpu.cfs_quota_us read -r period < /sys/fs/cgroup/cpu/cpu.cfs_period_us # Perform division and rounding GOMAXPROCS=$(( (quota + period - 1) / period )) else GOMAXPROCS=$(nproc) fi export GOMAXPROCS