[英]os.loadavg() returns different values than uptime
How come node's native os.loadavg() method returns different values than the uptime service? 节点的本机os.loadavg()方法如何返回与正常运行时间服务不同的值? The 15min average is about the same (and consistently so) but the other values always seem to vary somewhat. 15分钟的平均值大致相同(并且一直如此),但其他值似乎总是有所不同。 I was under the impression that there was an underlying system utility that provided these values to both of them, so they would always be the same. 我给人的印象是,有一个底层系统实用程序为它们提供了这些值,因此它们将始终相同。
> os.loadavg()
[ 1.16943359375,
1.26220703125,
1.3076171875 ]
uptime
9:40 up 25 mins, 5 users, load averages: 1.08 1.24 1.30
I'm running node v0.10.35 and Mac OS X Yosemite v10.10.1. 我正在运行节点v0.10.35和Mac OS X Yosemite v10.10.1。
On my Linux box, if I don't run them very close together then there's movement. 在我的Linux机器上,如果我没有将它们紧密地结合在一起运行,那将会有动静。 When I run them very closely together they match: 当我非常紧密地运行它们时,它们匹配:
$ node -e 'console.log(require("os").loadavg())'; uptime [ 0.130859375, 0.23876953125, 0.177734375 ] 09:39:30 up 175 days, 11:52, 6 users, load average: 0.13, 0.24, 0.18
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.