Docker: cap cpu and memory load at 100%

This commit is contained in:
bergware
2018-09-26 10:39:07 +02:00
parent 4937ca1d69
commit 62bb6156a6

View File

@@ -21,6 +21,7 @@ Markdown="false"
$width = strstr('white,black',$display['theme']) ? -58: -44;
$top = strstr('white,black',$display['theme']) ? 40 : 20;
$busy = "<i class='fa fa-spin fa-circle-o-notch'></i> Please wait... starting up containers";
$cpus = cpu_list();
?>
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.ui.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
@@ -147,8 +148,8 @@ watchDocker.on('message', function(data){
data = data.split('\n');
for (var i=0,row; row=data[i]; i++) {
var id = row.split(' ');
var w1 = Math.min(id[1].substr(0,id[1].length-1),100)+'%';
var w2 = Math.min(id[2].substr(0,id[2].length-1),100)+'%';
var w1 = Math.round(Math.min(id[1].substr(0,id[1].length-1)/<?=count($cpus)*count(preg_split('/[,-]/',$cpus[0]))?>,100)*100)/100+'%';
var w2 = Math.round(Math.min(id[2].substr(0,id[2].length-1),100)*100)/100+'%';
$('#cpu-'+id[0]).css('width',w1).text(w1.replace('.','<?=$display['number'][0]?>'));
$('#mem-'+id[0]).css('width',w2).text(w2.replace('.','<?=$display['number'][0]?>'));
}