code cleanup
This commit is contained in:
parent
831c50d8c9
commit
28675264a8
@ -100,6 +100,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| 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.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.4 | 2018-11-18 | windows: garbled output because of codepage |
|
||||||
| 3.48.3 | 2018-11-18 | `dockerContainerStats()` fixed issue `cpu_percent` win |
|
| 3.48.3 | 2018-11-18 | `dockerContainerStats()` fixed issue `cpu_percent` win |
|
||||||
|
|||||||
@ -141,7 +141,7 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) {
|
|||||||
let nanoSecNow = util.nanoSeconds();
|
let nanoSecNow = util.nanoSeconds();
|
||||||
let cpuPercent = 0.0;
|
let cpuPercent = 0.0;
|
||||||
if (_docker_last_read > 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;
|
let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage;
|
||||||
if (possIntervals > 0) {
|
if (possIntervals > 0) {
|
||||||
cpuPercent = 100.0 * intervalsUsed / possIntervals;
|
cpuPercent = 100.0 * intervalsUsed / possIntervals;
|
||||||
|
|||||||
@ -222,7 +222,7 @@ function execWin(cmd, opts, callback) {
|
|||||||
opts = execOptsWin;
|
opts = execOptsWin;
|
||||||
}
|
}
|
||||||
let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
|
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);
|
callback(error, stdout);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user