chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r811956 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/util/DumpChunks.java
Date Mon, 07 Sep 2009 00:19:41 GMT
Author: asrabkin
Date: Mon Sep  7 00:19:41 2009
New Revision: 811956

URL: http://svn.apache.org/viewvc?rev=811956&view=rev
Log:
CHUKWA-387.  Summarize mode for dumpChunks should count bytes.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=811956&r1=811955&r2=811956&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Mon Sep  7 00:19:41 2009
@@ -52,6 +52,8 @@
 
   IMPROVEMENTS
 
+    CHUKWA-387.  Summarize mode for dumpChunks should count bytes. (asrabkin)
+
     CHUKWA-379.  Refactor sender code. (asrabkin)
 
     CHUKWA-374.  Adaptor.getStatus() shouldn't throw exceptions. (asrabkin)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java?rev=811956&r1=811955&r2=811956&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java Mon Sep  7
00:19:41 2009
@@ -185,23 +185,31 @@
 
   static class DumpAndSummarize extends DumpChunks {
     Map<String, Integer> matchCounts = new LinkedHashMap<String, Integer>();
+    Map<String, Long> byteCounts = new LinkedHashMap<String, Long>();
     
 
     protected void displayResults(PrintStream out) throws IOException{
       for(Map.Entry<String, Integer> s: matchCounts.entrySet()) {
         out.print(s.getKey());
         out.print(" ");
-        out.println(s.getValue());
+        out.print(s.getValue());
+        out.print(" chunks ");
+        out.print(byteCounts.get(s.getKey()));
+        out.println(" bytes");
       }
         
     }
     
     protected void updateMatchCatalog(String streamName,  ChunkImpl chunk) {
       Integer i = matchCounts.get(streamName);
-      if(i != null)
+      if(i != null) {
         matchCounts.put(streamName, i+1);
-      else
+        Long b = byteCounts.get(streamName);
+        byteCounts.put(streamName, b + chunk.getLength());
+      } else {
         matchCounts.put(streamName, new Integer(1));
+        byteCounts.put(streamName, new Long(chunk.getLength()));
+      }
     }
     
   }



Mime
View raw message