processes() fix started (linux alpine)
This commit is contained in:
parent
3bcc64273a
commit
2dad549e23
@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||||
|
| 5.16.3 | 2022-12-09 | `processes()` fix started (linux alpine) |
|
||||||
| 5.16.3 | 2022-12-08 | `users()` fix when multiple explorer.exe (windows) |
|
| 5.16.3 | 2022-12-08 | `users()` fix when multiple explorer.exe (windows) |
|
||||||
| 5.16.2 | 2022-12-08 | `dockerContainerStats()` improved calculation cpuPercent |
|
| 5.16.2 | 2022-12-08 | `dockerContainerStats()` improved calculation cpuPercent |
|
||||||
| 5.16.1 | 2022-12-04 | code cleanup, moved from lgtm to GitHub Code Scan |
|
| 5.16.1 | 2022-12-04 | code cleanup, moved from lgtm to GitHub Code Scan |
|
||||||
|
|||||||
@ -57,9 +57,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">5.16.4</th>
|
||||||
|
<td>2022-12-09</td>
|
||||||
|
<td><span class="code">processes()</span> fix started (linux alpine)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">5.16.3</th>
|
<th scope="row">5.16.3</th>
|
||||||
<td>2022-12-04</td>
|
<td>2022-12-08</td>
|
||||||
<td><span class="code">users()</span> fix when multiple exporer.exe opened (windows)</td>
|
<td><span class="code">users()</span> fix when multiple exporer.exe opened (windows)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -170,7 +170,7 @@
|
|||||||
<img class="logo" src="assets/logo.png" alt="logo">
|
<img class="logo" src="assets/logo.png" alt="logo">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span> </div>
|
<div class="subtitle"><span id="typed"></span> </div>
|
||||||
<div class="version">New Version: <span id="version">5.16.3</span></div>
|
<div class="version">New Version: <span id="version">5.16.4</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">
|
||||||
|
|||||||
@ -655,7 +655,7 @@ function processes(callback) {
|
|||||||
function formatDateTime(time) {
|
function formatDateTime(time) {
|
||||||
const month = ('0' + (time.getMonth() + 1).toString()).substr(-2);
|
const month = ('0' + (time.getMonth() + 1).toString()).substr(-2);
|
||||||
const year = time.getFullYear().toString();
|
const year = time.getFullYear().toString();
|
||||||
const day = ('0' + time.getDay().toString()).substr(-2);
|
const day = ('0' + time.getDate().toString()).substr(-2);
|
||||||
const hours = time.getHours().toString();
|
const hours = time.getHours().toString();
|
||||||
const mins = time.getMinutes().toString();
|
const mins = time.getMinutes().toString();
|
||||||
const secs = ('0' + time.getSeconds().toString()).substr(-2);
|
const secs = ('0' + time.getSeconds().toString()).substr(-2);
|
||||||
@ -663,6 +663,21 @@ function processes(callback) {
|
|||||||
return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs);
|
return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseElapsed(etime) {
|
||||||
|
let started = '';
|
||||||
|
if (etime.indexOf('d') >= 0) {
|
||||||
|
const elapsed_parts = etime.split('d');
|
||||||
|
started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 24 + elapsed_parts[1] * 1) * 60 * 60 * 1000));
|
||||||
|
} else if (etime.indexOf('h') >= 0) {
|
||||||
|
const elapsed_parts = etime.split('h');
|
||||||
|
started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 60 + elapsed_parts[1] * 1) * 60 * 1000));
|
||||||
|
} else if (etime.indexOf(':') >= 0) {
|
||||||
|
const elapsed_parts = etime.split(':');
|
||||||
|
started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000)));
|
||||||
|
}
|
||||||
|
return started;
|
||||||
|
}
|
||||||
|
|
||||||
let result = [];
|
let result = [];
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
if (line.trim() !== '') {
|
if (line.trim() !== '') {
|
||||||
@ -670,8 +685,7 @@ function processes(callback) {
|
|||||||
const parts = line.split(' ');
|
const parts = line.split(' ');
|
||||||
const command = parts.slice(9).join(' ');
|
const command = parts.slice(9).join(' ');
|
||||||
const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1));
|
const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1));
|
||||||
const elapsed_parts = parts[5].split(':');
|
const started = parseElapsed(parts[5]);
|
||||||
const started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000)));
|
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
pid: parseInt(parts[0]),
|
pid: parseInt(parts[0]),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user