cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/4.2-forward to 7df1b43
Date Thu, 12 Sep 2013 04:31:30 GMT
Updated Branches:
  refs/heads/4.2-forward ec3464b66 -> 7df1b4316


simplify setCpuUsed

- variables inlined
- cpu utilization is not cast to float from double

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Signed-off-by: Min Chen <min.chen@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7df1b431
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7df1b431
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7df1b431

Branch: refs/heads/4.2-forward
Commit: 7df1b4316204efc8b07a9791d8aedd72335e51b4
Parents: ec3464b
Author: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Authored: Thu Aug 29 11:37:26 2013 +0200
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Sep 11 18:33:18 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7df1b431/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
index 8c4705b..7c16cc0 100644
--- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -165,14 +165,10 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO,
Long> implem
         userVmResponse.setKeyPairName(userVm.getKeypairName());
 
         if (details.contains(VMDetails.all) || details.contains(VMDetails.stats)) {
-            DecimalFormat decimalFormat = new DecimalFormat("#.##");
             // stats calculation
-            String cpuUsed = null;
             VmStats vmStats = ApiDBUtils.getVmStatistics(userVm.getId());
             if (vmStats != null) {
-                float cpuUtil = (float) vmStats.getCPUUtilization();
-                cpuUsed = decimalFormat.format(cpuUtil) + "%";
-                userVmResponse.setCpuUsed(cpuUsed);
+                userVmResponse.setCpuUsed(new DecimalFormat("#.##").format(vmStats.getCPUUtilization())
+ "%");
 
                 userVmResponse.setNetworkKbsRead((long) vmStats.getNetworkReadKBs());
 


Mime
View raw message