* Remove useless code.

This commit is contained in:
sunguangming
2023-11-30 15:15:16 +08:00
parent 31d70897a1
commit 2793aab1d9
2 changed files with 5 additions and 146 deletions
-66
View File
@@ -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.
*