DaanHoogland commented on a change in pull request #2075: [4.9+] 
CLOUDSTACK-9900: Fix high CPU deviation issues seen in metrics view
URL: https://github.com/apache/cloudstack/pull/2075#discussion_r114501952
 
 

 ##########
 File path: 
plugins/metrics/src/org/apache/cloudstack/response/ClusterMetricsResponse.java
 ##########
 @@ -128,10 +128,10 @@ public void setCpuAllocated(final Long cpuAllocated, 
final Long cpuTotal) {
         }
     }
 
-    public void setCpuMaxDeviation(final Double maxCpuDeviation, final Double 
totalCpuUsed, final Long totalHosts) {
-        if (maxCpuDeviation != null && totalCpuUsed != null && totalHosts != 
null && totalHosts != 0) {
-            final Double averageCpuUsage = totalCpuUsed / totalHosts;
-            this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuDeviation - 
averageCpuUsage) * 100.0 / averageCpuUsage);
+    public void setCpuMaxDeviation(final Double maxCpuUsagePercentage, final 
Double totalCpuUsedPercentage, final Long totalHosts) {
+        if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && 
totalHosts != null && totalHosts != 0) {
+            final Double averageCpuUsagePercentage = totalCpuUsedPercentage / 
totalHosts;
+            this.cpuMaxDeviation = String.format("%.2f%%", 
(maxCpuUsagePercentage - averageCpuUsagePercentage) * 1.0 / 
averageCpuUsagePercentage);
 
 Review comment:
   is the '* 1.0' needed when it is devided next? I would rather see a cast if 
it is, in this case
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to