code cleanup

This commit is contained in:
Sebastian Hildebrandt 2018-11-19 22:44:26 +01:00
parent 831c50d8c9
commit 28675264a8
3 changed files with 3 additions and 2 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.49.1 | 2018-11-19 | code cleanup |
| 3.49.0 | 2018-11-19 | added system `uuid()` (os specific), `versions()` added postgresql |
| 3.48.4 | 2018-11-18 | windows: garbled output because of codepage |
| 3.48.3 | 2018-11-18 | `dockerContainerStats()` fixed issue `cpu_percent` win |

View File

@ -141,7 +141,7 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) {
let nanoSecNow = util.nanoSeconds();
let cpuPercent = 0.0;
if (_docker_last_read > 0) {
let possIntervals = (nanoSecNow - _docker_last_read) // / 100 * os.cpus().length;
let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length;
let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage;
if (possIntervals > 0) {
cpuPercent = 100.0 * intervalsUsed / possIntervals;

View File

@ -222,7 +222,7 @@ function execWin(cmd, opts, callback) {
opts = execOptsWin;
}
let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
exec(newCmd, execOptsWin, function (error, stdout) {
exec(newCmd, opts, function (error, stdout) {
callback(error, stdout);
});
}