time() timezone name, l1 cache improvements

This commit is contained in:
Sebastian Hildebrandt 2021-11-14 19:57:36 +01:00
parent 61990bcc18
commit 7ca1d056c3
6 changed files with 29 additions and 14 deletions

View File

@ -80,6 +80,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.9.13 | 2021-11-14 | `time()` timezone name, `l1 cache` improvements |
| 5.9.12 | 2021-11-13 | `users()` fix data check (windows) |
| 5.9.11 | 2021-11-12 | `fsStats()` fix null result (bsd) |
| 5.9.10 | 2021-11-11 | `powerShell` transition from `wmic` (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.9.13</th>
<td>2021-11-14</td>
<td><span class="code">time()</span> timezone name, <span class="code">cpu()</span> l1 cache improvement</td>
</tr>
<tr>
<th scope="row">5.9.12</th>
<td>2021-11-13</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.9.12</span></div>
<div class="version">New Version: <span id="version">5.9.13</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>
</div>
<div class="down">

View File

@ -781,7 +781,7 @@ function getCpu() {
try {
const workload = [];
workload.push(util.powerShell('Get-WmiObject Win32_processor | fl *'));
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Purpose | fl *'));
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl *'));
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
@ -852,16 +852,21 @@ function getCpu() {
parts.forEach(function (part) {
lines = part.split('\r\n');
const cacheType = util.getValue(lines, 'CacheType');
const purpose = util.getValue(lines, 'Purpose');
const level = util.getValue(lines, 'Level');
const installedSize = util.getValue(lines, 'InstalledSize');
// L1 Instructions
if (purpose === 'L1 Cache' && cacheType === '3') {
if (level === '3' && cacheType === '3') {
result.cache.l1i = parseInt(installedSize, 10);
}
// L1 Data
if (purpose === 'L1 Cache' && cacheType === '4') {
if (level === '3' && cacheType === '4') {
result.cache.l1d = parseInt(installedSize, 10);
}
// L1 all
if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
result.cache.l1i = parseInt(installedSize, 10) / 2;
result.cache.l1d = parseInt(installedSize, 10) / 2;
}
});
// lines = data[2].split('\r\n');
// result.virtualization = (util.getValue(lines, 'HyperVRequirementVirtualizationFirmwareEnabled').toLowerCase() === 'true');
@ -1413,21 +1418,26 @@ function cpuCache(callback) {
if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
}
util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Purpose | fl ').then((stdout, error) => {
util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl ').then((stdout, error) => {
if (!error) {
const parts = stdout.split(/\n\s*\n/);
parts.forEach(function (part) {
const lines = part.split('\r\n');
const cacheType = util.getValue(lines, 'CacheType');
const purpose = util.getValue(lines, 'Purpose');
const level = util.getValue(lines, 'Level');
const installedSize = util.getValue(lines, 'InstalledSize');
// L1 Instructions
if (purpose === 'L1 Cache' && cacheType === '3') {
result.l1i = parseInt(installedSize, 10);
if (level === '3' && cacheType === '3') {
result.cache.l1i = parseInt(installedSize, 10);
}
// L1 Data
if (purpose === 'L1 Cache' && cacheType === '4') {
result.l1d = parseInt(installedSize, 10);
if (level === '3' && cacheType === '4') {
result.cache.l1d = parseInt(installedSize, 10);
}
// L1 all
if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
result.cache.l1i = parseInt(installedSize, 10) / 2;
result.cache.l1d = parseInt(installedSize, 10) / 2;
}
});
}

View File

@ -35,12 +35,11 @@ const _sunos = (_platform === 'sunos');
function time() {
let t = new Date().toString().split(' ');
return {
current: Date.now(),
uptime: os.uptime(),
timezone: (t.length >= 7) ? t[5] : '',
timezoneName: (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
};
}

View File

@ -93,6 +93,6 @@
"sunos"
],
"engines": {
"node": ">=4.0.0"
"node": ">=8.0.0"
}
}