cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [13/50] [abbrv] git commit: updated refs/heads/disk-cache to c3569db
Date Tue, 17 Sep 2013 14:01:34 GMT
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/cb3a3da7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb3a3da7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb3a3da7

Branch: refs/heads/disk-cache
Commit: cb3a3da75dc9cd450eb484af8841b2c52ac52fae
Parents: d3237e7
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 21:33:02 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/cb3a3da7/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 55726a2..7fe3c1d 100644
--- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -166,14 +166,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