* Remove useless code.
This commit is contained in:
@@ -449,72 +449,6 @@ class solutionModel extends model
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print CPU usage.
|
||||
*
|
||||
* @param object $solution
|
||||
* @param object $metrics
|
||||
* @param string $type 'bar' is progress bar, 'pie' is progress pie.
|
||||
* @static
|
||||
* @access public
|
||||
* @return viod
|
||||
*/
|
||||
public function printCpuUsage($solution, $type = 'bar')
|
||||
{
|
||||
/* Calculate total usage of all instances. */
|
||||
$totalRate = 0;
|
||||
$totalUsage = 0;
|
||||
$totalLimit = 0;
|
||||
$instancesMetric = $this->loadModel('cne')->instancesMetrics($solution->instances);
|
||||
foreach($instancesMetric as $metric)
|
||||
{
|
||||
$totalRate += $metric->cpu->rate;
|
||||
$totalUsage += $metric->cpu->usage;
|
||||
$totalLimit += $metric->cpu->limit;
|
||||
}
|
||||
|
||||
$totalRate = round($totalRate / count($solution->instances), 2);
|
||||
|
||||
$tip = "{$totalRate}% = {$totalUsage} / {$totalLimit}";
|
||||
|
||||
if(strtolower($type) == 'pie') return commonModel::printProgressPie($totalRate, '', $tip);
|
||||
|
||||
return commonModel::printProgressBar($totalRate, '', $tip, 'percent');
|
||||
}
|
||||
|
||||
/**
|
||||
* Print memory usage.
|
||||
*
|
||||
* @param object $solution
|
||||
* @param object $metrics
|
||||
* @param string $type 'bar' is progress bar, 'pie' is progress pie.
|
||||
* @static
|
||||
* @access public
|
||||
* @return viod
|
||||
*/
|
||||
public function printMemUsage($solution, $type = 'bar')
|
||||
{
|
||||
/* Calculate total usage of all instances. */
|
||||
$totalRate = 0;
|
||||
$totalUsage = 0;
|
||||
$totalLimit = 0;
|
||||
$instancesMetric = $this->loadModel('cne')->instancesMetrics($solution->instances);
|
||||
foreach($instancesMetric as $metric)
|
||||
{
|
||||
$totalRate += $metric->memory->rate;
|
||||
$totalUsage += $metric->memory->usage;
|
||||
$totalLimit += $metric->memory->limit;
|
||||
}
|
||||
|
||||
$totalRate = round($totalRate / count($solution->instances), 2);
|
||||
|
||||
$tip = "{$totalRate}% = {$totalUsage} / {$totalLimit}";
|
||||
|
||||
if(strtolower($type) == 'pie') return commonModel::printProgressPie($totalRate, '', $tip);
|
||||
|
||||
return commonModel::printProgressBar($totalRate, '', $tip, 'percent');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save message to error log file.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user