I'm monitoring the CPU usage of my NodeJS application by the means of the os.cpus() function. When printing the return values of the function, I noticed some cores show negative values for user time and idle time. Is that even possible?
Edit:
Here is one of the CPUs in the returned object of that function call.
{ model: 'Intel(R) Xeon(R) CPU E7540 @ 2.00GHz',
speed: 1064,
times: {
user: -599586196,
nice: 46900,
sys: 726751700,
idle: -1356274912,
irq: 1000
}
},
This error was due to a conversion error in the file node_os.cc in the /src folder of Node.JS. The problem and the solution are shown here https://github.com/joyent/node/commit/50e88d0. As a matter of fact, I was using an old version of node (0.8.12). Upgrading to the latest version fixed the bug.