diff --git a/CHANGELOG.md b/CHANGELOG.md
index 64c83d8..695e2d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
+| 5.1.0 | 2020-02-08 | `memLayout()` added ECC flag |
| 5.0.11 | 2020-02-07 | `fsSize()` fixed windows WSL issue |
| 5.0.10 | 2020-02-06 | `getDynamicData()` fixed windows WSL issue |
| 5.0.9 | 2020-02-02 | `fsSize()` fixed parsing edge case issue mac OS |
diff --git a/README.md b/README.md
index af4c769..602b5ef 100644
--- a/README.md
+++ b/README.md
@@ -101,13 +101,13 @@ si.cpu()
(last 7 major and minor version releases)
+- Version 5.1.0: `memLayout()` added ECC flag
- Version 5.0.0: new version 5 - attention there are some breaking changes. See [detailed version 5 changes here][changes5-url].
- Version 4.34.0: `system()` added flag virtual (linux, windows)
- Version 4.33.0: `graphics()` added nvidia-smi support (linux, windows)
- Version 4.32.0: `graphics()` added clinfo support (linux)
- Version 4.31.0: `osInfo()` added FQDN
- Version 4.30.0: `get()` added possibility to provide parameters
-- Version 4.29.0: `fsSize()` correct fs type detection macOS (HFS, APFS, NFS)
- ...
You can find all changes here: [detailed changelog][changelog-url]
diff --git a/docs/history.html b/docs/history.html
index c34bc31..d3582d9 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -56,6 +56,11 @@
+
+ 5.1.0
+ 2020-02-08
+ memLayout() added ECC flag
+
5.0.11
2020-02-07
diff --git a/docs/index.html b/docs/index.html
index 4fa7ce5..6661746 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.0.11
+ New Version: 5.1.0
View on Github
diff --git a/docs/memory.html b/docs/memory.html
index 93d5533..e70a5c0 100644
--- a/docs/memory.html
+++ b/docs/memory.html
@@ -259,6 +259,16 @@ si.mem().then(data => console.log(data));
memory type
+
+
+ [0].ecc
+ X
+ X
+ X
+ X
+
+ ECC memory
+
[0].clockSpeed
diff --git a/lib/index.d.ts b/lib/index.d.ts
index 13c8f20..552618e 100644
--- a/lib/index.d.ts
+++ b/lib/index.d.ts
@@ -123,6 +123,7 @@ export namespace Systeminformation {
size: number;
bank: string;
type: string;
+ ecc?: boolean;
clockSpeed: number;
formFactor: string;
partNum: string;
diff --git a/lib/memory.js b/lib/memory.js
index 2357385..90bfc1c 100644
--- a/lib/memory.js
+++ b/lib/memory.js
@@ -317,10 +317,13 @@ function memLayout(callback) {
const sizeString = util.getValue(lines, 'Size');
const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
+ const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
+ const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
result.push({
size,
bank: util.getValue(lines, 'Bank Locator'),
type: util.getValue(lines, 'Type:'),
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)),
formFactor: util.getValue(lines, 'Form Factor:'),
manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
@@ -335,6 +338,7 @@ function memLayout(callback) {
size: 0,
bank: util.getValue(lines, 'Bank Locator'),
type: 'Empty',
+ ecc: null,
clockSpeed: 0,
formFactor: util.getValue(lines, 'Form Factor:'),
partNum: '',
@@ -351,6 +355,7 @@ function memLayout(callback) {
size: os.totalmem(),
bank: '',
type: '',
+ ecc: null,
clockSpeed: 0,
formFactor: '',
partNum: '',
@@ -375,10 +380,11 @@ function memLayout(callback) {
'2': 450,
'3': 3200
};
- result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
- result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed;
result[0].type = 'LPDDR2';
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
+ result[0].ecc = false;
+ result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
+ result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed;
result[0].formFactor = 'SoC';
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
@@ -410,6 +416,8 @@ function memLayout(callback) {
if (_darwin) {
exec('system_profiler SPMemoryDataType', function (error, stdout) {
if (!error) {
+ const allLines = stdout.toString().split('\n');
+ const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
let devices = stdout.toString().split(' BANK ');
let hasBank = true;
if (devices.length === 1) {
@@ -426,6 +434,7 @@ function memLayout(callback) {
size: size * 1024 * 1024 * 1024,
bank: bank,
type: util.getValue(lines, ' Type:'),
+ ecc: eccStatus ? eccStatus === 'enabled' : null,
clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10),
formFactor: '',
manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')),
@@ -440,6 +449,7 @@ function memLayout(callback) {
size: 0,
bank: bank,
type: 'Empty',
+ ecc: null,
clockSpeed: 0,
formFactor: '',
manufacturer: '',
@@ -461,6 +471,7 @@ function memLayout(callback) {
size: size * 1024 * 1024 * 1024,
bank: 0,
type,
+ ecc: false,
clockSpeed: 0,
formFactor: '',
manufacturer: 'Apple',
@@ -492,10 +503,13 @@ function memLayout(callback) {
devices.shift();
devices.forEach(function (device) {
let lines = device.split('\r\n');
+ const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', '='));
+ const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', '='));
result.push({
size: parseInt(util.getValue(lines, 'Capacity', '='), 10) || 0,
bank: util.getValue(lines, 'abel', '='), // BankLabel
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', '='), 10)],
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10) || 0,
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10) || 0],
manufacturer: util.getValue(lines, 'Manufacturer', '='),