dockerContainerStats() improved calculation cpuPercent
This commit is contained in:
parent
5d17a86a2c
commit
94e5187d88
@ -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.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 |
|
||||||
| 5.16.0 | 2022-12-01 | `fsSize()` added rw (win, linux, mac OS, BSD) |
|
| 5.16.0 | 2022-12-01 | `fsSize()` added rw (win, linux, mac OS, BSD) |
|
||||||
| 5.15.1 | 2022-11-29 | fix typescript typings |
|
| 5.15.1 | 2022-11-29 | fix typescript typings |
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
[![Git Issues][issues-img]][issues-url]
|
[![Git Issues][issues-img]][issues-url]
|
||||||
[![Closed Issues][closed-issues-img]][closed-issues-url]
|
[![Closed Issues][closed-issues-img]][closed-issues-url]
|
||||||
<img src="docs/assets/no-dependencies.svg" alt="no dependencies">
|
<img src="docs/assets/no-dependencies.svg" alt="no dependencies">
|
||||||
[![Caretaker][caretaker-image]][caretaker-url]
|
|
||||||
[![Sponsoring][sponsor-badge]][sponsor-url]
|
[![Sponsoring][sponsor-badge]][sponsor-url]
|
||||||
|
[![Caretaker][caretaker-image]][caretaker-url]
|
||||||
[![MIT license][license-img]][license-url]
|
[![MIT license][license-img]][license-url]
|
||||||
|
|
||||||
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
|
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
|
||||||
@ -1057,7 +1057,7 @@ All other trademarks are the property of their respective owners.
|
|||||||
[downloads-image]: https://img.shields.io/npm/dm/systeminformation.svg?style=flat-square
|
[downloads-image]: https://img.shields.io/npm/dm/systeminformation.svg?style=flat-square
|
||||||
[downloads-url]: https://npmjs.org/package/systeminformation
|
[downloads-url]: https://npmjs.org/package/systeminformation
|
||||||
|
|
||||||
[sponsor-badge]: https://img.shields.io/badge/-Buy%20me%20a%20coffee-blue?style=flat-square
|
[sponsor-badge]: https://img.shields.io/badge/Support-Buy%20me%20a%20coffee-brightgreen?style=flat-square
|
||||||
[sponsor-url]: https://www.buymeacoffee.com/systeminfo
|
[sponsor-url]: https://www.buymeacoffee.com/systeminfo
|
||||||
|
|
||||||
[license-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/LICENSE
|
[license-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/LICENSE
|
||||||
|
|||||||
@ -57,6 +57,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">5.16.2</th>
|
||||||
|
<td>2022-12-04</td>
|
||||||
|
<td>code cleanup, moved from lgtm to GitHub Code Scan</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">5.16.1</th>
|
<th scope="row">5.16.1</th>
|
||||||
<td>2022-12-04</td>
|
<td>2022-12-04</td>
|
||||||
|
|||||||
@ -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.1</span></div>
|
<div class="version">New Version: <span id="version">5.16.2</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">
|
||||||
|
|||||||
@ -361,8 +361,13 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) {
|
|||||||
|
|
||||||
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
||||||
// calculate the change for the cpu usage of the container in between readings
|
// calculate the change for the cpu usage of the container in between readings
|
||||||
|
if (precpu_stats.online_cpus) {
|
||||||
|
cpuPercent = (cpuDelta / systemDelta) * precpu_stats.online_cpus * 100.0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0;
|
cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cpuPercent;
|
return cpuPercent;
|
||||||
} else {
|
} else {
|
||||||
@ -706,6 +711,7 @@ function dockerVolumes(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.dockerVolumes = dockerVolumes;
|
exports.dockerVolumes = dockerVolumes;
|
||||||
|
|
||||||
function dockerAll(callback) {
|
function dockerAll(callback) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user