Node.js文档-os
2021-05-01 14:28
标签:model OLE 系统 cpu div mem pre use const 获取操作系统相关信息 获取当前机器的CPU信息 打印结果: 获取当前机器的内存总量,单位为字节 打印结果: 单位为字节,除以1024为KB,再除以1024为MB,再除以1024为GB(上面的结果为16GB) Node.js文档-os 标签:model OLE 系统 cpu div mem pre use const 原文地址:https://www.cnblogs.com/lianglanlan/p/12144377.html引用
const os = require(‘os‘)
os.cpus()
console.log(os.cpus())
[ { model: ‘Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz‘,
speed: 2300,
times:
{ user: 1332960, nice: 0, sys: 928720, idle: 5905010, irq: 0 } },
{ model: ‘Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz‘,
speed: 2300,
times:
{ user: 684730, nice: 0, sys: 490170, idle: 6991300, irq: 0 } },
{ model: ‘Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz‘,
speed: 2300,
times:
{ user: 1315900, nice: 0, sys: 741750, idle: 6108540, irq: 0 } },
{ model: ‘Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz‘,
speed: 2300,
times:
{ user: 596770, nice: 0, sys: 406270, idle: 7163160, irq: 0 } } ]
os.totalmem()
console.log(os.totalmem())
17179869184
下一篇:seajs入门实例