Skip to content
Browse files

rename Reporter classes to Report

  • Loading branch information...
1 parent 9f33e6b commit 8db061d7a005168e872efba527140fb9c7a591f1 Noah Davis committed Mar 13, 2011
View
2 benchmark/oink.rb
@@ -7,7 +7,7 @@
Benchmark.bmbm(15) do |x|
x.report("Running Oink") {
f = File.open(File.expand_path(File.dirname(__FILE__) + "/../logs/production.log"))
- Oink::MemoryUsageReporter.new([f], 75*1024).print(STDOUT)
+ Oink::MemoryUsageReport.new([f], 75*1024).print(STDOUT)
f.close
}
end
View
4 lib/oink.rb
@@ -1,5 +1,5 @@
-require "oink/reports/memory_usage_reporter"
-require "oink/reports/active_record_instantiation_reporter"
+require "oink/reports/memory_usage_report"
+require "oink/reports/active_record_instantiation_report"
require 'oink/utils/hash_utils'
require "oink/cli"
View
4 lib/oink/cli.rb
@@ -62,13 +62,13 @@ def process
options[:threshold] ||= 75
options[:threshold] *= 1024
- Oink::Reports::MemoryUsageReporter.new(handles, options[:threshold], :format => options[:format]).print(output)
+ Oink::Reports::MemoryUsageReport.new(handles, options[:threshold], :format => options[:format]).print(output)
elsif options[:type] == :active_record
options[:threshold] ||= 500
- Oink::Reports::ActiveRecordInstantiationReporter.new(handles, options[:threshold], :format => options[:format]).print(output)
+ Oink::Reports::ActiveRecordInstantiationReport.new(handles, options[:threshold], :format => options[:format]).print(output)
end
View
2 ...s/active_record_instantiation_reporter.rb → ...rts/active_record_instantiation_report.rb
@@ -5,7 +5,7 @@
module Oink
module Reports
- class ActiveRecordInstantiationReporter < Base
+ class ActiveRecordInstantiationReport < Base
def print(output)
output.puts "---- OINK FOR ACTIVERECORD ----"
View
2 lib/oink/reports/memory_usage_reporter.rb → lib/oink/reports/memory_usage_report.rb
@@ -5,7 +5,7 @@
module Oink
module Reports
- class MemoryUsageReporter < Base
+ class MemoryUsageReport < Base
def print(output)
output.puts "---- MEMORY THRESHOLD ----"
output.puts "THRESHOLD: #{@threshold/1024} MB\n"
View
24 ...ive_record_instantiation_reporter_spec.rb → ...ctive_record_instantiation_report_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
module Oink::Reports
- describe ActiveRecordInstantiationReporter do
+ describe ActiveRecordInstantiationReport do
describe "short summary with frequent offenders" do
@@ -14,7 +14,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should include("1, Users#show")
end
@@ -27,7 +27,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should_not include("1, Users#show")
end
@@ -43,7 +43,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should include("2, Users#show")
end
@@ -62,7 +62,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output[-2].should == "2, Media#show"
output[-1].should == "1, Users#show"
end
@@ -80,7 +80,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should include("1, Users#show")
end
@@ -97,7 +97,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should include("1. Feb 01 01:58:31, 51, Users#show")
end
@@ -110,7 +110,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output.should_not include("1. Feb 01 01:58:31, 50, Users#show")
end
@@ -126,7 +126,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50).print(output)
+ ActiveRecordInstantiationReport.new(io, 50).print(output)
output[4].should == "1. Feb 01 01:58:34, 100, MediaController#show"
output[5].should == "2. Feb 01 01:58:31, 75, DetailsController#show"
end
@@ -142,7 +142,7 @@ module Oink::Reports
STR
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50, :format => :verbose).print(output)
+ ActiveRecordInstantiationReport.new(io, 50, :format => :verbose).print(output)
output[3..5].should == str.split("\n")[0..2].map { |o| o.strip }
end
@@ -159,7 +159,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new(io, 50, :format => :verbose).print(output)
+ ActiveRecordInstantiationReport.new(io, 50, :format => :verbose).print(output)
output[3..5].should == str.split("\n")[4..6].map { |o| o.strip }
end
end
@@ -182,7 +182,7 @@ module Oink::Reports
io1 = StringIO.new(str1)
io2 = StringIO.new(str2)
output = PsuedoOutput.new
- ActiveRecordInstantiationReporter.new([io1, io2], 50).print(output)
+ ActiveRecordInstantiationReport.new([io1, io2], 50).print(output)
output.should include("2, MediaController#show")
end
View
28 ...ink/reports/memory_usage_reporter_spec.rb → .../oink/reports/memory_usage_report_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
module Oink::Reports
- describe MemoryUsageReporter do
+ describe MemoryUsageReport do
TEN_MEGS = 10 * 1024
@@ -19,7 +19,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should include("1, MediaController#show")
end
@@ -37,7 +37,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should_not include("1, MediaController#show")
end
@@ -56,7 +56,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should include("2, MediaController#show")
end
@@ -78,7 +78,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output[-2].should == "2, MediaController#show"
output[-1].should == "1, Users#show"
end
@@ -97,7 +97,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should_not include("1, MediaController#show")
end
@@ -113,7 +113,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should_not include("1, MediaController#show")
end
@@ -131,7 +131,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should include("1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show")
end
@@ -147,7 +147,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output.should_not include("1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show")
end
@@ -166,7 +166,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS).print(output)
output[4].should == "1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show"
output[5].should == "2. Feb 01 01:58:37, #{TEN_MEGS + 1} KB, DetailsController#show"
end
@@ -185,7 +185,7 @@ module Oink::Reports
#
# io = StringIO.new(str)
# output = PsuedoOutput.new
- # MemoryUsageReporter.new(io, TEN_MEGS).each_line do |line|
+ # MemoryUsageReport.new(io, TEN_MEGS).each_line do |line|
# output << line
# end
# output.first.should == "Feb 01 01:58:29 - Mar 13 03:58:30"
@@ -207,7 +207,7 @@ module Oink::Reports
STR
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS, :format => :verbose).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS, :format => :verbose).print(output)
output[3..6].should == str.split("\n")[4..7].map { |o| o.strip }
end
@@ -228,7 +228,7 @@ module Oink::Reports
io = StringIO.new(str)
output = PsuedoOutput.new
- MemoryUsageReporter.new(io, TEN_MEGS, :format => :verbose).print(output)
+ MemoryUsageReport.new(io, TEN_MEGS, :format => :verbose).print(output)
output[3..5].should == str.split("\n")[6..8].map { |o| o.strip }
end
end
@@ -257,7 +257,7 @@ module Oink::Reports
io1 = StringIO.new(str1)
io2 = StringIO.new(str2)
output = PsuedoOutput.new
- MemoryUsageReporter.new([io1, io2], TEN_MEGS).print(output)
+ MemoryUsageReport.new([io1, io2], TEN_MEGS).print(output)
output.should include("2, MediaController#show")
end

0 comments on commit 8db061d

Please sign in to comment.
Something went wrong with that request. Please try again.