CPU

In this section you will learn how to get CPU data including current speed and temperature:

For function reference and examples we assume, that we imported systeminformation as follows:

const si = require('systeminformation');

CPU Data

All functions in this section return a promise or can be called with a callback function (parameter cb in the function reference)

Function Result object Linux BSD Mac Win Sun Comments
si.cpu(cb) {...} X X X X CPU information object
manufacturer X X X X e.g. 'Intel(R)'
brand X X X X e.g. 'Core(TM)2 Duo'
speed X X X X in GHz e.g. '3.40'
speedmin X X X in GHz e.g. '0.80'
speedmax X X X X in GHz e.g. '3.90'
governor X e.g. 'powersave'
cores X X X X # cores
physicalCores X X X X # physical cores
efficiencyCores X # efficiency cores (ARM only)
performanceCores X # performance cores (ARM only)
processors X X X X # processors
socket X X X socket type e.g. "LGA1356"
vendor X X X X vendor ID
family X X X X processor family
model X X X X processor model
stepping X X X X processor stepping
revision X X X revision
voltage X voltage
cache X X X X cache in bytes (object)
cache.l1d X X X X L1D (data) size
cache.l1i X X X X L1I (instruction) size
cache.l2 X X X X L2 size
cache.l3 X X X X L3 size
Example
const si = require('systeminformation');
si.cpu().then(data => console.log(data));
{
    manufacturer: 'Intel®',
    brand: 'Core™ i9-9900',
    vendor: 'GenuineIntel',
    family: '6',
    model: '158',
    stepping: '13',
    revision: '',
    voltage: '',
    speed: '3.10',
    speedmin: '0.80',
    speedmax: '5.00',
    governor: 'powersave',
    cores: 16,
    physicalCores: 8,
    processors: 1,
    socket: 'LGA1151',
    cache: { l1d: 262144, l1i: 262144, l2: 2, l3: 16 },
    flags: 'fpu vme de pse ...'
}
si.cpuFlags(cb) : string X X X X CPU flags
Example
const si = require('systeminformation');
si.cpuFlags().then(data => console.log(data));
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
si.cpuCache(cb) {...} X X X X CPU cache sizes object
l1d X X X X L1D size
l1i X X X X L1I size
l2 X X X X L2 size
l3 X X X X L3 size
Example
const si = require('systeminformation');
si.cpuCache().then(data => console.log(data));
{ l1d: 262144, l1i: 262144, l2: 2, l3: 16 }
si.cpuCurrentspeed(cb) {...} X X X X X current CPU speed (GHz) object
avg X X X X X avg CPU speed (all cores)
min X X X X X min CPU speed (all cores)
max X X X X X max CPU speed (all cores)
cores X X X X X CPU speed per core (array)
Example
const si = require('systeminformation');
si.cpuCurrentspeed().then(data => console.log(data));
{
  min: 0.86,
  max: 1.77,
  avg: 1.49,
  cores: [
    1.59, 1.71, 1.62, 1.57,
    1.66, 1.77, 1.74, 1.75,
    1.49, 1.51, 1.52, 1.59,
    1.56, 1.03, 0.86, 0.86
  ]
}
si.cpuTemperature(cb) {...} X X X* X CPU temperature (if supported)
main X X X X main temperature (avg)
cores X X X X array of temperatures
max X X X X max temperature
Example
const si = require('systeminformation');
si.cpuTemperature().then(data => console.log(data));
{ main: 42, cores: [], max: 42 }

Known issues

macOS - Temperature

To be able to measure temperature on macOS I created a little additional package. Due to some difficulties in NPM with optionalDependencies I unfortunately was getting unexpected warnings on other platforms. So I decided to drop this optional dependency for macOS - so by default, you will not get correct values.

But if you need to detect macOS temperature just run the following additional installation command:

$ npm install osx-temperature-sensor --save

systeminformation will then detect this additional library and return the temperature when calling systeminformations standard function cpuTemperature()

Windows Temperature

wmic - which is used to determine battery sometimes needs to be run with admin privileges. So if you do not get any values, try to run it again with according privileges. If you still do not get any values, your system might not support this feature.