incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/3] git commit: Code cleanup.
Date Fri, 14 Sep 2012 12:50:46 GMT
Updated Branches:
  refs/heads/master 8901ad697 -> 6d05a5e8f


Code cleanup.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/6d05a5e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/6d05a5e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/6d05a5e8

Branch: refs/heads/master
Commit: 6d05a5e8f8acd20409a4ceadbd03c40a331d6704
Parents: 8e2287e
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Sep 14 08:50:26 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Sep 14 08:50:26 2012 -0400

----------------------------------------------------------------------
 .../java/org/apache/blur/metrics/HeapMetrics.java  |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/6d05a5e8/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java b/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
index 0534871..e754cf6 100644
--- a/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
@@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
 
 public class HeapMetrics extends TimerTask {
 
+  private static final double ONE_GIG = 1024 * 1024 * 1024;
   private final int sampleSize = (int) TimeUnit.MINUTES.toSeconds(10);
   private final Timer timer;
   private final long period = TimeUnit.SECONDS.toMillis(1);
@@ -50,15 +51,19 @@ public class HeapMetrics extends TimerTask {
 
   public void writeJson(PrintWriter out) {
     synchronized (this) {
-      out.print("{\"labels\":[{\"name\":\"used\",\"style\":{\"stroke\":\"RoyalBlue\"}},{\"name\":\"committed\",\"style\":{\"stroke\":\"Red\"}}],\"data\":[");
+      out.print("{\"labels\":[");
+      out.print("{\"name\":\"used\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
+      out.print("{\"name\":\"committed\",\"style\":{\"stroke\":\"Red\"}},");
+      out.print("],\"data\":[");
       int p = position;
       boolean comma = false;
       for (int i = 0; i < sampleSize; i++, p++) {
         if (p >= sampleSize) {
           p = 0;
         }
-        double used = ((double) heapMemoryUsageUsedHistory[p]) / 1000000000.0;
-        double committed = ((double) heapMemoryUsageCommittedHistory[p]) / 1000000000.0;
+        double used = ((double) heapMemoryUsageUsedHistory[p]) / ONE_GIG;
+        double committed = ((double) heapMemoryUsageCommittedHistory[p]) / ONE_GIG;
+
         long t = timestamp[p];
         if (t == 0) {
           continue;


Mime
View raw message