about summary refs log tree commit homepage
path: root/lib/mongrel/stats.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mongrel/stats.rb')
-rw-r--r--lib/mongrel/stats.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/mongrel/stats.rb b/lib/mongrel/stats.rb
index 38ed173..9e8bf7c 100644
--- a/lib/mongrel/stats.rb
+++ b/lib/mongrel/stats.rb
@@ -57,9 +57,15 @@ class Stats
 
   # Dump this Stats object with an optional additional message.
   def dump(msg = "", out=STDERR)
-    out.puts "[#{@name}] #{msg} : SUM=#@sum, SUMSQ=#@sumsq, N=#@n, MEAN=#{mean}, SD=#{sd}, MIN=#@min, MAX=#@max"
+    out.puts "#{msg}: #{self.to_s}"
   end
 
+  # Returns a common display (used by dump)
+  def to_s  
+    "[#{@name}]: SUM=%0.4f, SUMSQ=%0.4f, N=%0.4f, MEAN=%0.4f, SD=%0.4f, MIN=%0.4f, MAX=%0.4f" % [@sum, @sumsq, @n, mean, sd, @min, @max]
+  end
+
+
   # Calculates and returns the mean for the data passed so far.
   def mean
     @sum / @n