memLayout() added ECC flag

This commit is contained in:
Sebastian Hildebrandt 2021-02-07 15:44:54 +01:00
parent 412d9573c3
commit 00faa546e8
7 changed files with 35 additions and 4 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment | | 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.11 | 2020-02-07 | `fsSize()` fixed windows WSL issue |
| 5.0.10 | 2020-02-06 | `getDynamicData()` 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 | | 5.0.9 | 2020-02-02 | `fsSize()` fixed parsing edge case issue mac OS |

View File

@ -101,13 +101,13 @@ si.cpu()
(last 7 major and minor version releases) (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 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.34.0: `system()` added flag virtual (linux, windows)
- Version 4.33.0: `graphics()` added nvidia-smi support (linux, windows) - Version 4.33.0: `graphics()` added nvidia-smi support (linux, windows)
- Version 4.32.0: `graphics()` added clinfo support (linux) - Version 4.32.0: `graphics()` added clinfo support (linux)
- Version 4.31.0: `osInfo()` added FQDN - Version 4.31.0: `osInfo()` added FQDN
- Version 4.30.0: `get()` added possibility to provide parameters - 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] You can find all changes here: [detailed changelog][changelog-url]

View File

@ -56,6 +56,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.1.0</th>
<td>2020-02-08</td>
<td><span class="code">memLayout()</span> added ECC flag</td>
</tr>
<tr> <tr>
<th scope="row">5.0.11</th> <th scope="row">5.0.11</th>
<td>2020-02-07</td> <td>2020-02-07</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png"> <img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.0.11</span></div> <div class="version">New Version: <span id="version">5.1.0</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button> <button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div> </div>
<div class="down"> <div class="down">

View File

@ -259,6 +259,16 @@ si.mem().then(data => console.log(data));</code></pre class="example">
<td></td> <td></td>
<td>memory type</td> <td>memory type</td>
</tr> </tr>
<tr>
<td></td>
<td>[0].ecc</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td></td>
<td>ECC memory</td>
</tr>
<tr> <tr>
<td></td> <td></td>
<td>[0].clockSpeed</td> <td>[0].clockSpeed</td>

1
lib/index.d.ts vendored
View File

@ -123,6 +123,7 @@ export namespace Systeminformation {
size: number; size: number;
bank: string; bank: string;
type: string; type: string;
ecc?: boolean;
clockSpeed: number; clockSpeed: number;
formFactor: string; formFactor: string;
partNum: string; partNum: string;

View File

@ -317,10 +317,13 @@ function memLayout(callback) {
const sizeString = util.getValue(lines, 'Size'); const sizeString = util.getValue(lines, 'Size');
const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024; 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) { 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({ result.push({
size, size,
bank: util.getValue(lines, 'Bank Locator'), bank: util.getValue(lines, 'Bank Locator'),
type: util.getValue(lines, 'Type:'), 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)), 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:'), formFactor: util.getValue(lines, 'Form Factor:'),
manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')), manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
@ -335,6 +338,7 @@ function memLayout(callback) {
size: 0, size: 0,
bank: util.getValue(lines, 'Bank Locator'), bank: util.getValue(lines, 'Bank Locator'),
type: 'Empty', type: 'Empty',
ecc: null,
clockSpeed: 0, clockSpeed: 0,
formFactor: util.getValue(lines, 'Form Factor:'), formFactor: util.getValue(lines, 'Form Factor:'),
partNum: '', partNum: '',
@ -351,6 +355,7 @@ function memLayout(callback) {
size: os.totalmem(), size: os.totalmem(),
bank: '', bank: '',
type: '', type: '',
ecc: null,
clockSpeed: 0, clockSpeed: 0,
formFactor: '', formFactor: '',
partNum: '', partNum: '',
@ -375,10 +380,11 @@ function memLayout(callback) {
'2': 450, '2': 450,
'3': 3200 '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 = 'LPDDR2';
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type; 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'; result[0].formFactor = 'SoC';
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null'); stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
@ -410,6 +416,8 @@ function memLayout(callback) {
if (_darwin) { if (_darwin) {
exec('system_profiler SPMemoryDataType', function (error, stdout) { exec('system_profiler SPMemoryDataType', function (error, stdout) {
if (!error) { if (!error) {
const allLines = stdout.toString().split('\n');
const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
let devices = stdout.toString().split(' BANK '); let devices = stdout.toString().split(' BANK ');
let hasBank = true; let hasBank = true;
if (devices.length === 1) { if (devices.length === 1) {
@ -426,6 +434,7 @@ function memLayout(callback) {
size: size * 1024 * 1024 * 1024, size: size * 1024 * 1024 * 1024,
bank: bank, bank: bank,
type: util.getValue(lines, ' Type:'), type: util.getValue(lines, ' Type:'),
ecc: eccStatus ? eccStatus === 'enabled' : null,
clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10), clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10),
formFactor: '', formFactor: '',
manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')), manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')),
@ -440,6 +449,7 @@ function memLayout(callback) {
size: 0, size: 0,
bank: bank, bank: bank,
type: 'Empty', type: 'Empty',
ecc: null,
clockSpeed: 0, clockSpeed: 0,
formFactor: '', formFactor: '',
manufacturer: '', manufacturer: '',
@ -461,6 +471,7 @@ function memLayout(callback) {
size: size * 1024 * 1024 * 1024, size: size * 1024 * 1024 * 1024,
bank: 0, bank: 0,
type, type,
ecc: false,
clockSpeed: 0, clockSpeed: 0,
formFactor: '', formFactor: '',
manufacturer: 'Apple', manufacturer: 'Apple',
@ -492,10 +503,13 @@ function memLayout(callback) {
devices.shift(); devices.shift();
devices.forEach(function (device) { devices.forEach(function (device) {
let lines = device.split('\r\n'); let lines = device.split('\r\n');
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', '='));
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', '='));
result.push({ result.push({
size: parseInt(util.getValue(lines, 'Capacity', '='), 10) || 0, size: parseInt(util.getValue(lines, 'Capacity', '='), 10) || 0,
bank: util.getValue(lines, 'abel', '='), // BankLabel bank: util.getValue(lines, 'abel', '='), // BankLabel
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', '='), 10)], type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', '='), 10)],
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10) || 0, clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10) || 0,
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10) || 0], formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10) || 0],
manufacturer: util.getValue(lines, 'Manufacturer', '='), manufacturer: util.getValue(lines, 'Manufacturer', '='),