简体   繁体   English

os.loadavg()返回的值与正常运行时间不同

[英]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.

相关问题 什么是Windows的os.loadavg()的替代品 - What's an alternative to os.loadavg() for Windows 我们无法从 /proc/uptime 中找到正常运行时间,使用 os.uptime() 值,Pm2 3.5 错误 - We couldn't find uptime from /proc/uptime, using os.uptime() value, Pm2 3.5 error $ http获取的收益不同于$ resource获取的收益 - $http get returns different than $resource get 为什么 Date().toLocaleString 在 nodejs 中返回与浏览器不同的值? - Why does Date().toLocaleString returns different value in nodejs than browser? Gremlin NodeJS 查询返回的结果与 Groovy 不同 - Gremlin NodeJS query returns different results than Groovy 对于小于 1 的值 Math.acosh() 返回 NaN - For values less than 1 Math.acosh() returns NaN Nodejs os.uptime()返回错误的正常运行时间值(毫秒) - Nodejs os.uptime() return incorrect up-time value by millisecond NodeJs SQLite 查询返回数据库上直接 SQL 以外的其他值 - NodeJs SQLite query returns other values than direct SQL on database 为什么JavaScript“ this”在节点和浏览器环境中返回不同的值? - Why does JavaScript “this” returns different values in Node and Browser environments? NPM 'crypto' 返回与在线生成器(节点)不同的哈希值 - NPM 'crypto' returning different hash values than online generators (node)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM