diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e8287..757e0af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.28.0 | 2025-12-25 | `cpuTemperature()` added suppurt for macos-temperature-sensor (macOS) | | 5.27.17 | 2025-12-24 | `graphics()` fix nvidia-smi candidateDir (windows) | | 5.27.16 | 2025-12-23 | `cpuTemperature()` fix sensors parsingg AMD (linux) | | 5.27.15 | 2025-12-22 | Updated docs | diff --git a/README.md b/README.md index 4a15ae4..bf5d330 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ si.cpu() (last 7 major and minor version releases) +- Version 5.28.0: `mem()` added suppurt for macos-temperature-sensor (macOS) - Version 5.27.0: `mem()` added reclaimable memory - Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer - Version 5.25.0: `versions()` added homebrew @@ -346,7 +347,7 @@ Full function reference with examples can be found at | | cores | X | X | X | X | | array of temperatures | | | max | X | X | X | X | | max temperature | | | socket | X | | | | | array socket temperatures | -| | chipset | X | | | | | chipset temperature | +| | chipset | X | | X | | | chipset temperature | #### 4. Memory diff --git a/docs/cpu.html b/docs/cpu.html index 4717b2d..bb1e78f 100644 --- a/docs/cpu.html +++ b/docs/cpu.html @@ -595,15 +595,14 @@ si.cpuTemperature().then(data => console.log(data));

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 +

To be able to measure temperature on macOS I created twu little additional packages. 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.

-

This additional package is now also suppprting Apple Silicon M1 machines.

+

But if you need to detect macOS temperature just run the following additional installation command. Wether you have Intel or Apple Silicon machines, install one of the following packages:

-

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

- -
$ npm install osx-temperature-sensor --save
+
$ npm install osx-temperature-sensor      # deprecated - for intel based machines
+
$ npm install macos-temperature-sensor    # for apple silicon machines

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

Windows Temperature

diff --git a/docs/history.html b/docs/history.html index a2a400f..9218d16 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.28.0 + 2025-12-25 + cpuTemperature() added suppurt for macos-temperature-sensor (macOS) + 5.27.17 2025-12-24 diff --git a/docs/index.html b/docs/index.html index 514439a..2b09ef5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.27.17
+
New Version: 5.28.0
@@ -204,7 +204,7 @@
-
18,542
+
19,496
Lines of code
diff --git a/docs/issues.html b/docs/issues.html index 87e5030..36fd8e7 100644 --- a/docs/issues.html +++ b/docs/issues.html @@ -46,15 +46,15 @@

macOS - Temperature

-

To be able to measure temperature on macOS I created a little additional package. Due to some difficulties in NPM with optionalDependencies +

To be able to measure temperature on macOS I created twu little additional packages. 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.

-

This additional package is now also supporting Apple Silicon M1 machines.

+

But if you need to detect macOS temperature just run the following additional installation command. Wether you have Intel or Apple Silicon machines, install one of the following packages:

-

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

+
$ npm install osx-temperature-sensor      # deprecated - for intel based machines
+
$ npm install macos-temperature-sensor    # for apple silicon machines
-
$ 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, Battery, ...

diff --git a/lib/cpu.js b/lib/cpu.js index d7818b9..602bd25 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -495,7 +495,181 @@ const AMDBaseFrequencies = { 9254: '2.9', 9224: '2.5', '9174F': '4.1', - 9124: '3.0' + 9124: '3.0', + + // Epyc 4th gen + '4124P': '3.8', + '4244P': '3.8', + '4344P': '3.8', + '4364P': '4.5', + '4464P': '3.7', + '4484PX': '4.4', + '4564P': '4.5', + '4584PX': '4.2', + '8024P': '2.4', + '8024PN': '2.05', + '8124P': '2.45', + '8124PN': '2.0', + '8224P': '2.55', + '8224PN': '2.0', + '8324P': '2.65', + '8324PN': '2.05', + '8434P': '2.5', + '8434PN': '2.0', + '8534P': '2.3', + '8534PN': '2.0', + + // Epyc 5th gen + 9115: '2.6', + 9135: '3.65', + '9175F': '4.2', + 9255: '3.25', + '9275F': '4.1', + 9335: '3.0', + '9355P': '3.55', + 9355: '3.55', + '9375F': '3.8', + 9365: '3.4', + '9455P': '3.15', + 9455: '3.15', + '9475F': '3.65', + 9535: '2.4', + '9555P': '3.2', + 9555: '3.2', + '9575F': '3.3', + 9565: '3.15', + '9655P': '2.5', + 9655: '2.5', + 9755: '2.7', + '4245P': '3.9', + '4345P': '3.8', + '4465P': '3.4', + '4545P': '3.0', + '4565P': '4.3', + '4585PX': '4.3', + '5900XT': '3.3', + 5900: '3.0', + 5945: '3.0', + '5800X3D': '3.4', + '5800XT': '3.8', + 5800: '3.4', + '5700X3D': '3.0', + '5700X': '3.4', + 5845: '3.4', + '5600X3D': '3.3', + '5600XT': '3.7', + '5600T': '3.5', + 5600: '3.5', + '5600F': '3.0', + 5645: '3.7', + '5500X3D': '3.0', + '5980HX': '3.3', + '5980HS': '3.0', + '5900HX': '3.3', + '5900HS': '3.0', + '5800H': '3.2', + '5800HS': '2.8', + '5800U': '1.9', + '5600H': '3.3', + '5600HS': '3.0', + '5600U': '2.3', + '5560U': '2.3', + '5400U': '2.7', + '5825U': '2.0', + '5625U': '2.3', + '5425U': '2.7', + '5125C': '3.0', + '7730U': '2.0', + '7530U': '2.0', + '7430U': '2.3', + '7330U': '2.3', + 7203: '2.8', + 7303: '2.4', + '7663P': '2.0', + '6980HX': '3.3', + '6980HS': '3.3', + '6900HX': '3.3', + '6900HS': '3.3', + '6800H': '3.2', + '6800HS': '3.2', + '6800U': '2.7', + '6600H': '3.3', + '6600HS': '3.3', + '6600U': '2.9', + '7735HS': '3.2', + '7735H': '3.2', + '7736U': '2.7', + '7735U': '2.7', + '7435HS': '3.1', + '7435H': '3.1', + '7535HS': '3.3', + '7535H': '3.3', + '7535U': '2.9', + '7235HS': '3.2', + '7235H': '3.2', + '7335U': '3.0', + 270: '4.0', + 260: '3.8', + 250: '3.3', + 240: '4.3', + 230: '3.5', + 220: '3.0', + 210: '2.8', + '8945HS': '4.0', + '8845HS': '3.8', + '8840HS': '3.3', + '8840U': '3.3', + '8645HS': '4.3', + '8640HS': '3.5', + '8640U': '3.5', + '8540U': '3.0', + '8440U': '2.8', + '9950X3D': '4.3', + '9950X': '4.3', + '9900X3D': '4.4', + '9900X': '4.4', + '9800X3D': '4.7', + '9700X': '3.8', + '9700F': '3.8', + '9600X': '3.9', + 9600: '3.8', + '9500F': '3.8', + '9995WX': '2.5', + '9985WX': '3.2', + '9975WX': '4.0', + '9965WX': '4.2', + '9955WX': '4.5', + '9945WX': '4.7', + '9980X': '3.2', + '9970X': '4.0', + '9960X': '4.2', + 'PRO HX375': '2.0', + HX375: '2.0', + 'PRO HX370': '2.0', + HX370: '2.0', + 365: '2.0', + 'PRO 360': '2.0', + 350: '2.0', + 'PRO 350': '2.0', + 340: '2.0', + 'PRO 340': '2.0', + 330: '2.0', + 395: '3.0', + 'PRO 395': '3.0', + 390: '3.2', + 'PRO 390': '3.2', + 385: '3.6', + 'PRO 385': '3.6', + 'PRO 380': '3.6', + '9955HX3D': '2.3', + '9955HX': '2.5', + '9850HX': '3.0', + 9015: '3.6', + 9965: '2.25', + 9845: '2.1', + 9825: '2.2', + 9745: '2.4', + 9645: '2.3' }; const socketTypes = { @@ -1327,7 +1501,7 @@ function cpuTemperature(callback) { }); }); }); - } catch (er) { + } catch { if (callback) { callback(result); } @@ -1337,7 +1511,7 @@ function cpuTemperature(callback) { if (_freebsd || _openbsd || _netbsd) { exec('sysctl dev.cpu | grep temp', (error, stdout) => { if (!error) { - let lines = stdout.toString().split('\n'); + const lines = stdout.toString().split('\n'); let sum = 0; lines.forEach((line) => { const parts = line.split(':'); @@ -1379,7 +1553,26 @@ function cpuTemperature(callback) { } catch { util.noop(); } - // add new macOS temperature library here + try { + const macosTemp = require('macos-temperature-sensor'); + const res = macosTemp.temperature(); + if (res.cpu) { + // round to 2 digits + result.main = Math.round(res.cpu * 100) / 100; + result.max = result.main; + } + if (res.soc) { + // round to 2 digits + result.chipset = Math.round(res.soc * 100) / 100; + } + if (res?.cpuDieTemps.length) { + for (const temp of res.cpuDieTemps) { + result.cores.push(Math.round(temp * 100) / 100); + } + } + } catch { + util.noop(); + } if (callback) { callback(result); @@ -1397,12 +1590,12 @@ function cpuTemperature(callback) { util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => { if (!error) { let sum = 0; - let lines = stdout + const lines = stdout .split('\r\n') .filter((line) => line.trim() !== '') .filter((line, idx) => idx > 0); - lines.forEach(function (line) { - let value = (parseInt(line, 10) - 2732) / 10; + lines.forEach((line) => { + const value = (parseInt(line, 10) - 2732) / 10; if (!isNaN(value)) { sum = sum + value; if (value > result.max) { @@ -1420,7 +1613,7 @@ function cpuTemperature(callback) { } resolve(result); }); - } catch (e) { + } catch { if (callback) { callback(result); } @@ -1508,14 +1701,14 @@ function cpuFlags(callback) { exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => { if (!error) { let lines = stdout.toString().split('\n'); - lines.forEach(function (line) { + lines.forEach((line) => { if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) { result = line.split(':')[1].trim().toLowerCase(); } }); } if (!result) { - fs.readFile('/proc/cpuinfo', function (error, stdout) { + fs.readFile('/proc/cpuinfo', (error, stdout) => { if (!error) { let lines = stdout.toString().split('\n'); result = util.getValue(lines, 'features', ':', true).toLowerCase(); @@ -1532,7 +1725,7 @@ function cpuFlags(callback) { resolve(result); } }); - } catch (e) { + } catch { if (callback) { callback(result); } @@ -1541,12 +1734,12 @@ function cpuFlags(callback) { } if (_freebsd || _openbsd || _netbsd) { exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', (error, stdout) => { - let flags = []; + const flags = []; if (!error) { - let parts = stdout.toString().split('\tFlags:'); + const parts = stdout.toString().split('\tFlags:'); const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : []; - lines.forEach(function (line) { - let flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, ''); + lines.forEach((line) => { + const flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, ''); if (flag) { flags.push(flag); } @@ -1601,9 +1794,9 @@ function cpuCache(callback) { try { exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => { if (!error) { - let lines = stdout.toString().split('\n'); - lines.forEach(function (line) { - let parts = line.split(':'); + const lines = stdout.toString().split('\n'); + lines.forEach((line) => { + const parts = line.split(':'); if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) { result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1); } @@ -1623,7 +1816,7 @@ function cpuCache(callback) { } resolve(result); }); - } catch (e) { + } catch { if (callback) { callback(result); } @@ -1662,10 +1855,10 @@ function cpuCache(callback) { }); } if (_darwin) { - exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', (error, stdout) => { + exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', (error, stdout) => { if (!error) { let lines = stdout.toString().split('\n'); - lines.forEach(function (line) { + lines.forEach((line) => { let parts = line.split(':'); if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) { result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); @@ -1707,7 +1900,7 @@ function cpuCache(callback) { } resolve(result); }); - } catch (e) { + } catch { if (callback) { callback(result); } @@ -1719,7 +1912,7 @@ function cpuCache(callback) { } function parseWinCache(linesProc, linesCache) { - let result = { + const result = { l1d: null, l1i: null, l2: null, @@ -1748,7 +1941,7 @@ function parseWinCache(linesProc, linesCache) { let l1i = 0; let l1d = 0; let l2 = 0; - parts.forEach(function (part) { + parts.forEach((part) => { const lines = part.split('\r\n'); const cacheType = util.getValue(lines, 'CacheType'); const level = util.getValue(lines, 'Level'); @@ -1789,16 +1982,16 @@ exports.cpuCache = cpuCache; function getLoad() { return new Promise((resolve) => { process.nextTick(() => { - let loads = os.loadavg().map( (x) => { + const loads = os.loadavg().map((x) => { return x / util.cores(); }); - let avgLoad = parseFloat(Math.max.apply(Math, loads).toFixed(2)); + const avgLoad = parseFloat(Math.max.apply(Math, loads).toFixed(2)); let result = {}; - let now = Date.now() - _current_cpu.ms; + const now = Date.now() - _current_cpu.ms; if (now >= 200) { _current_cpu.ms = Date.now(); - const cpus = os.cpus().map(function (cpu) { + const cpus = os.cpus().map((cpu) => { cpu.times.steal = 0; cpu.times.guest = 0; return cpu; @@ -1810,7 +2003,7 @@ function getLoad() { let totalIdle = 0; let totalSteal = 0; let totalGuest = 0; - let cores = []; + const cores = []; _corecount = cpus && cpus.length ? cpus.length : 0; // linux: try to get other cpu stats @@ -1831,7 +2024,7 @@ function getLoad() { } } } - } catch (e) { + } catch { util.noop(); } } @@ -1845,15 +2038,15 @@ function getLoad() { totalIrq += cpu.irq; totalSteal += cpu.steal || 0; totalGuest += cpu.guest || 0; - let tmpTick = _cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0; - let tmpLoad = _cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0; - let tmpUser = _cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0; - let tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0; - let tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0; - let tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0; - let tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0; - let tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0; - let tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0; + const tmpTick = _cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0; + const tmpLoad = _cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0; + const tmpUser = _cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0; + const tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0; + const tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0; + const tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0; + const tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0; + const tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0; + const tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0; _cpus[i] = cpu; _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle; _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest; diff --git a/lib/network.js b/lib/network.js index 70cd1b3..f50248c 100644 --- a/lib/network.js +++ b/lib/network.js @@ -786,7 +786,7 @@ function networkInterfaces(callback, rescan, defaultString) { nics.forEach((nic) => { if ({}.hasOwnProperty.call(ifaces, nic.iface)) { - ifaces[nic.iface].forEach(function (details) { + ifaces[nic.iface].forEach((details) => { if (details.family === 'IPv4' || details.family === 4) { nic.ip4subnet = details.netmask; }