温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/os/cpus
点击访问原文链接

Node os.cpus function | API Reference | Bun

Node os.cpus function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:os/cpusFcpus

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:os/cpusFcpus

function

os.cpusfunction cpus(): CpuInfo[];

Returns an array of objects containing information about each logical CPU core. The array will be empty if no CPU information is available, such as if the /proc file system is unavailable.

The properties included on each object include:

[
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
speed: 2926,
times: {
user: 252020,
nice: 0,
sys: 30340,
idle: 1070356870,
irq: 0,
},
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
speed: 2926,
times: {
user: 306960,
nice: 0,
sys: 26980,
idle: 1071569080,
irq: 0,
},
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
speed: 2926,
times: {
user: 248450,
nice: 0,
sys: 21750,
idle: 1070919370,
irq: 0,
},
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
speed: 2926,
times: {
user: 256880,
nice: 0,
sys: 19430,
idle: 1070905480,
irq: 20,
},
},
]

nice values are POSIX-only. On Windows, the nice values of all processors are always 0.

os.cpus().length should not be used to calculate the amount of parallelism available to an application. Use availableParallelism for this purpose.

Referenced typesinterface CpuInfomodel: stringspeed: numbertimes: { idle: number; irq: number; nice: number; sys: number; user: number }

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node os.cpus function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:os.cpus | Bun