hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1079213 - in /hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters: FileSystemCounterGroup.java FrameworkCounterGroup.java
Date Tue, 08 Mar 2011 05:56:43 GMT
Author: omalley
Date: Tue Mar  8 05:56:43 2011
New Revision: 1079213

URL: http://svn.apache.org/viewvc?rev=1079213&view=rev
Log:
commit 37d6c160d4582442237580b23af37510b4a6b709
Author: Luke Lu <llu@yahoo-inc.com>
Date:   Wed Dec 8 15:23:28 2010 -0800

     Fix malformed counters table in jobdetails ui.

Modified:
    hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java
    hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FrameworkCounterGroup.java

Modified: hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java?rev=1079213&r1=1079212&r2=1079213&view=diff
==============================================================================
--- hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java
(original)
+++ hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FileSystemCounterGroup.java
Tue Mar  8 05:56:43 2011
@@ -221,8 +221,11 @@ public abstract class FileSystemCounterG
 
   @Override
   public int size() {
-    // It's used for reserve space anyway.
-    return map.size() * FileSystemCounter.values().length;
+    int n = 0;
+    for (Object[] counters : map.values()) {
+      n += numSetCounters(counters);
+    }
+    return n;
   }
 
   @Override

Modified: hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FrameworkCounterGroup.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FrameworkCounterGroup.java?rev=1079213&r1=1079212&r2=1079213&view=diff
==============================================================================
--- hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FrameworkCounterGroup.java
(original)
+++ hadoop/mapreduce/branches/yahoo-merge/src/java/org/apache/hadoop/mapreduce/counters/FrameworkCounterGroup.java
Tue Mar  8 05:56:43 2011
@@ -182,8 +182,11 @@ public abstract class FrameworkCounterGr
 
   @Override
   public int size() {
-    // It's used for reserve space anyway.
-    return counters.length;
+    int n = 0;
+    for (int i = 0; i < counters.length; ++i) {
+      if (counters[i] != null) ++n;
+    }
+    return n;
   }
 
   @Override
@@ -204,7 +207,7 @@ public abstract class FrameworkCounterGr
   @Override
   @SuppressWarnings("unchecked")
   public void write(DataOutput out) throws IOException {
-    WritableUtils.writeVInt(out, numSetCounters());
+    WritableUtils.writeVInt(out, size());
     for (int i = 0; i < counters.length; ++i) {
       Counter counter = (C) counters[i];
       if (counter != null) {
@@ -214,14 +217,6 @@ public abstract class FrameworkCounterGr
     }
   }
 
-  private int numSetCounters() {
-    int n = 0;
-    for (int i = 0; i < counters.length; ++i) {
-      if (counters[i] != null) ++n;
-    }
-    return n;
-  }
-
   @Override
   public void readFields(DataInput in) throws IOException {
     clear();
@@ -258,7 +253,7 @@ public abstract class FrameworkCounterGr
   }
 
   @Override
-  public synchronized boolean equals(Object genericRight) {
+  public boolean equals(Object genericRight) {
     if (genericRight instanceof CounterGroupBase<?>) {
       @SuppressWarnings("unchecked")
       CounterGroupBase<C> right = (CounterGroupBase<C>) genericRight;



Mime
View raw message