From 9ffc74a0b2c1f31d1ab1ee28fa77e9602f163732 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sat, 20 Jan 2024 15:59:08 +0100 Subject: [PATCH] updated docs, code cleanup --- docs/index.html | 6 +++--- docs/v4/index.html | 4 ++-- lib/cpu.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/index.html b/docs/index.html index 5c0918a6..90d62989 100644 --- a/docs/index.html +++ b/docs/index.html @@ -189,9 +189,9 @@
Node.js system information package. Lightweight collection of 50+ functions to retrieve detailed hardware, system and OS information. For Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD, SunOS and Android support. Dependency free.
#1 NPM ranking for backend packages
- NPM Version + NPM Version no dependencies - MIT license + MIT license
Security issues: Please have a look at our security advisories.
@@ -212,7 +212,7 @@
Downloads last month
-
668
+
676
Dependents
diff --git a/docs/v4/index.html b/docs/v4/index.html index 83a7a198..1850a75e 100644 --- a/docs/v4/index.html +++ b/docs/v4/index.html @@ -187,9 +187,9 @@
Overview
Lightweight collection of 40+ functions to retrieve detailed hardware, system and OS information. For Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD, SunOS and Android support
- NPM Version + NPM Version no dependencies - MIT license + MIT license
Version 4 maintenance: We are still maintaining version 4 and providing especially fixes to security issues and other important fixes. New functionality is only added to the new version 5, so please consider upgrading to version 5 soon. Version 5 is NOT fully backward compatible to version 4! Be aware, there are some breaking changes. Please refer to the Version 5 - Changes page to see a full documentation of all changes you should have a look on.
Version 5 documentation can be found here.
diff --git a/lib/cpu.js b/lib/cpu.js index 2a6d2442..dfe25d5c 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -766,8 +766,8 @@ function getCpu() { const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1'; const processors = util.getValue(lines, 'socket(s)') || '1'; - let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores) - let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1) + const threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores) + const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1) const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900) result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt; result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;