<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 
+v4.1. Support calculating deltas in analyze utility.
+
 v4.0. Track spawn points live instead of sampling.
 
 v3.7.1. Fix some nil issues with corrupted dumps (cody caughlan).</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -3,11 +3,11 @@
 require 'rubygems'
 
 if !ARGV[0]
-  puts &quot;Please specify a BleakHouse logfile&quot;
+  puts &quot;Please specify up to two BleakHouse logfiles&quot;
   exit
 else
   $LOAD_PATH &lt;&lt; &quot;#{File.dirname(__FILE__)}/../lib/&quot;
   require 'bleak_house/analyzer'
   require 'ruby-debug' if ENV['DEBUG']
-  BleakHouse::Analyzer.run(ARGV[0], ARGV[1] || 20)
+  BleakHouse::Analyzer.run(*ARGV)
 end</diff>
      <filename>bin/bleak</filename>
    </modified>
    <modified>
      <diff>@@ -2,23 +2,52 @@
 module BleakHouse
   module Analyzer
 
-    # Analyze a compatible &lt;tt&gt;bleak.dump&lt;/tt&gt;. Accepts a filename and the number of lines to display.
-    def self.run(file, lines)
-      filled, free = `tail -n 2 #{file}`.split(&quot;\n&quot;)
-      unless filled =~ /filled/ and free =~ /free/
-        raise &quot;#{file} is incomplete or corrupted&quot;
-      end
-
-      length = `wc #{file}`.to_i - 2      
+    # Analyze a compatible &lt;tt&gt;bleak.dump&lt;/tt&gt;. Accepts one or more filename and the number of lines to display.
+    def self.run(*args)
+      lines = args.last[/^\d+$/] ? args.pop.to_i : 20
 
-      puts &quot;#{length} total objects&quot;
-      puts &quot;Final heap size #{filled}, #{free}&quot;
-      puts &quot;Displaying top #{lines} most common line/class pairs\n&quot;            
-        
-      cmd = ENV['NO_TRACE'] ? &quot;awk -F: '{print $3}' &quot; + file : &quot;cat #{file}&quot;      
-      cmd += &quot; | sort | uniq -c | sort -nr | head -#{lines}&quot;
+      raise &quot;Can't diff more than 2 files&quot; if args.size &gt; 2
+      
+      outputs = args.map do |file|          
+        filled, free = `tail -n 2 #{file}`.split(&quot;\n&quot;)
+        unless filled =~ /filled/ and free =~ /free/
+          raise &quot;#{file} is incomplete or corrupted&quot;
+        end
+  
+        length = `wc #{file}`.to_i - 2      
+        cmd = ENV['NO_TRACE'] ? &quot;awk -F: '{print $3}' &quot; + file : &quot;cat #{file}&quot;      
+        cmd += &quot; | sort | uniq -c | sort -nr | head -#{lines}&quot;
+  
+        [&quot;#{length} total objects&quot;, &quot;#{filled} heap slots&quot;, &quot;#{free} heap slots&quot;] + `#{cmd}`.split(&quot;\n&quot;)
+      end
+    
+      if outputs.size == 1
+        # Just output the data
+        puts &quot;Displaying top #{lines} most common line/class pairs&quot;        
+        puts outputs.first
+      else
+        puts &quot;Displaying change in top #{lines} most common line/class pairs&quot;        
+        puts diff(outputs)
+      end
 
-      puts `#{cmd}`
+    end
+    
+    def self.diff(outputs)
+      # Calculate the diff
+      diff = Hash.new(0)
+      # Iterate each item
+      outputs.each_with_index do |output, index|
+        output[3..-1].each do |line|
+          c, key = line.split(&quot; &quot;, 2)
+          index.zero? ? diff[key] -= c.to_i : diff[key] += c.to_i
+        end
+      end
+      # Format the lines in descending order
+      diff.sort_by do |key, value|
+        -value
+      end.map do |key, value|
+        &quot;#{value.to_s.rjust(6)} #{key}&quot;
+      end    
     end
     
   end</diff>
      <filename>lib/bleak_house/analyzer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5ae0882cad5192a1739f234c3a3740a912ab4ff7</id>
    </parent>
  </parents>
  <author>
    <name>Evan Weaver</name>
    <email>evan@cloudbur.st</email>
  </author>
  <url>http://github.com/fauna/bleak_house/commit/e39df9ed3dbe15509acf3d7c2daa213e56b95bba</url>
  <id>e39df9ed3dbe15509acf3d7c2daa213e56b95bba</id>
  <committed-date>2008-05-20T20:57:03-07:00</committed-date>
  <authored-date>2008-05-20T20:57:03-07:00</authored-date>
  <message>Deltas.</message>
  <tree>2d1879c88a106e0f1188bc975891dd3df303078f</tree>
  <committer>
    <name>Evan Weaver</name>
    <email>evan@cloudbur.st</email>
  </committer>
</commit>
