Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6A77B10549 for ; Thu, 12 Sep 2013 04:31:33 +0000 (UTC) Received: (qmail 655 invoked by uid 500); 12 Sep 2013 04:31:33 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 287 invoked by uid 500); 12 Sep 2013 04:31:32 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 236 invoked by uid 99); 12 Sep 2013 04:31:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Sep 2013 04:31:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5EF308BF321; Thu, 12 Sep 2013 04:31:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2-forward to 7df1b43 Date: Thu, 12 Sep 2013 04:31:30 +0000 (UTC) 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 Signed-off-by: Min Chen 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 Authored: Thu Aug 29 11:37:26 2013 +0200 Committer: Min Chen 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 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());