const { cpus } = require('os');
const measure = () => cpus().map(c => c.times.idle);
const diff = (first, second) => second.map((v, i) => v - first[i]);
setTimeout(((first) => () => console.log(diff(first, measure())))(measure()), 1000);
Always.
Within 1000ms, each core cannot spend more than (approximately) 1000ms idle.
[
10200, 10200,
10100, 10200,
10000, 10000,
9900, 10000
]
I cannot reproduce the problem on Windows, so I assumed it's a problem in libuv, but the code in libuv seems correct to me.
That was actually fixed just three days ago, see libuv/libuv@37a8aff. :-)
@bnoordhuis Oh, nice! That explains it :D Any idea when that patch might make it into a Node.js release?
Probably sometime in May. The last libuv release was just last week.
I believe this has been resolved in master
Most helpful comment
Probably sometime in May. The last libuv release was just last week.