Skip to content
This repository
Browse code

rename Reporter classes to Report

  • Loading branch information...
commit 8db061d7a005168e872efba527140fb9c7a591f1 1 parent 9f33e6b
Noah Davis authored
2  benchmark/oink.rb
@@ -7,7 +7,7 @@
7 7 Benchmark.bmbm(15) do |x|
8 8 x.report("Running Oink") {
9 9 f = File.open(File.expand_path(File.dirname(__FILE__) + "/../logs/production.log"))
10   - Oink::MemoryUsageReporter.new([f], 75*1024).print(STDOUT)
  10 + Oink::MemoryUsageReport.new([f], 75*1024).print(STDOUT)
11 11 f.close
12 12 }
13 13 end
4 lib/oink.rb
... ... @@ -1,5 +1,5 @@
1   -require "oink/reports/memory_usage_reporter"
2   -require "oink/reports/active_record_instantiation_reporter"
  1 +require "oink/reports/memory_usage_report"
  2 +require "oink/reports/active_record_instantiation_report"
3 3 require 'oink/utils/hash_utils'
4 4 require "oink/cli"
5 5
4 lib/oink/cli.rb
@@ -62,13 +62,13 @@ def process
62 62 options[:threshold] ||= 75
63 63 options[:threshold] *= 1024
64 64
65   - Oink::Reports::MemoryUsageReporter.new(handles, options[:threshold], :format => options[:format]).print(output)
  65 + Oink::Reports::MemoryUsageReport.new(handles, options[:threshold], :format => options[:format]).print(output)
66 66
67 67 elsif options[:type] == :active_record
68 68
69 69 options[:threshold] ||= 500
70 70
71   - Oink::Reports::ActiveRecordInstantiationReporter.new(handles, options[:threshold], :format => options[:format]).print(output)
  71 + Oink::Reports::ActiveRecordInstantiationReport.new(handles, options[:threshold], :format => options[:format]).print(output)
72 72
73 73 end
74 74
2  ...k/reports/active_record_instantiation_reporter.rb → ...ink/reports/active_record_instantiation_report.rb
@@ -5,7 +5,7 @@
5 5
6 6 module Oink
7 7 module Reports
8   - class ActiveRecordInstantiationReporter < Base
  8 + class ActiveRecordInstantiationReport < Base
9 9
10 10 def print(output)
11 11 output.puts "---- OINK FOR ACTIVERECORD ----"
2  lib/oink/reports/memory_usage_reporter.rb → lib/oink/reports/memory_usage_report.rb
@@ -5,7 +5,7 @@
5 5
6 6 module Oink
7 7 module Reports
8   - class MemoryUsageReporter < Base
  8 + class MemoryUsageReport < Base
9 9 def print(output)
10 10 output.puts "---- MEMORY THRESHOLD ----"
11 11 output.puts "THRESHOLD: #{@threshold/1024} MB\n"
24 ...orts/active_record_instantiation_reporter_spec.rb → ...eports/active_record_instantiation_report_spec.rb
... ... @@ -1,7 +1,7 @@
1 1 require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2 2
3 3 module Oink::Reports
4   - describe ActiveRecordInstantiationReporter do
  4 + describe ActiveRecordInstantiationReport do
5 5
6 6 describe "short summary with frequent offenders" do
7 7
@@ -14,7 +14,7 @@ module Oink::Reports
14 14
15 15 io = StringIO.new(str)
16 16 output = PsuedoOutput.new
17   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  17 + ActiveRecordInstantiationReport.new(io, 50).print(output)
18 18 output.should include("1, Users#show")
19 19 end
20 20
@@ -27,7 +27,7 @@ module Oink::Reports
27 27
28 28 io = StringIO.new(str)
29 29 output = PsuedoOutput.new
30   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  30 + ActiveRecordInstantiationReport.new(io, 50).print(output)
31 31 output.should_not include("1, Users#show")
32 32 end
33 33
@@ -43,7 +43,7 @@ module Oink::Reports
43 43
44 44 io = StringIO.new(str)
45 45 output = PsuedoOutput.new
46   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  46 + ActiveRecordInstantiationReport.new(io, 50).print(output)
47 47 output.should include("2, Users#show")
48 48 end
49 49
@@ -62,7 +62,7 @@ module Oink::Reports
62 62
63 63 io = StringIO.new(str)
64 64 output = PsuedoOutput.new
65   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  65 + ActiveRecordInstantiationReport.new(io, 50).print(output)
66 66 output[-2].should == "2, Media#show"
67 67 output[-1].should == "1, Users#show"
68 68 end
@@ -80,7 +80,7 @@ module Oink::Reports
80 80
81 81 io = StringIO.new(str)
82 82 output = PsuedoOutput.new
83   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  83 + ActiveRecordInstantiationReport.new(io, 50).print(output)
84 84 output.should include("1, Users#show")
85 85 end
86 86
@@ -97,7 +97,7 @@ module Oink::Reports
97 97
98 98 io = StringIO.new(str)
99 99 output = PsuedoOutput.new
100   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  100 + ActiveRecordInstantiationReport.new(io, 50).print(output)
101 101 output.should include("1. Feb 01 01:58:31, 51, Users#show")
102 102 end
103 103
@@ -110,7 +110,7 @@ module Oink::Reports
110 110
111 111 io = StringIO.new(str)
112 112 output = PsuedoOutput.new
113   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  113 + ActiveRecordInstantiationReport.new(io, 50).print(output)
114 114 output.should_not include("1. Feb 01 01:58:31, 50, Users#show")
115 115 end
116 116
@@ -126,7 +126,7 @@ module Oink::Reports
126 126
127 127 io = StringIO.new(str)
128 128 output = PsuedoOutput.new
129   - ActiveRecordInstantiationReporter.new(io, 50).print(output)
  129 + ActiveRecordInstantiationReport.new(io, 50).print(output)
130 130 output[4].should == "1. Feb 01 01:58:34, 100, MediaController#show"
131 131 output[5].should == "2. Feb 01 01:58:31, 75, DetailsController#show"
132 132 end
@@ -142,7 +142,7 @@ module Oink::Reports
142 142 STR
143 143 io = StringIO.new(str)
144 144 output = PsuedoOutput.new
145   - ActiveRecordInstantiationReporter.new(io, 50, :format => :verbose).print(output)
  145 + ActiveRecordInstantiationReport.new(io, 50, :format => :verbose).print(output)
146 146 output[3..5].should == str.split("\n")[0..2].map { |o| o.strip }
147 147 end
148 148
@@ -159,7 +159,7 @@ module Oink::Reports
159 159
160 160 io = StringIO.new(str)
161 161 output = PsuedoOutput.new
162   - ActiveRecordInstantiationReporter.new(io, 50, :format => :verbose).print(output)
  162 + ActiveRecordInstantiationReport.new(io, 50, :format => :verbose).print(output)
163 163 output[3..5].should == str.split("\n")[4..6].map { |o| o.strip }
164 164 end
165 165 end
@@ -182,7 +182,7 @@ module Oink::Reports
182 182 io1 = StringIO.new(str1)
183 183 io2 = StringIO.new(str2)
184 184 output = PsuedoOutput.new
185   - ActiveRecordInstantiationReporter.new([io1, io2], 50).print(output)
  185 + ActiveRecordInstantiationReport.new([io1, io2], 50).print(output)
186 186 output.should include("2, MediaController#show")
187 187 end
188 188
28 spec/oink/reports/memory_usage_reporter_spec.rb → spec/oink/reports/memory_usage_report_spec.rb
... ... @@ -1,7 +1,7 @@
1 1 require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2 2
3 3 module Oink::Reports
4   - describe MemoryUsageReporter do
  4 + describe MemoryUsageReport do
5 5
6 6 TEN_MEGS = 10 * 1024
7 7
@@ -19,7 +19,7 @@ module Oink::Reports
19 19
20 20 io = StringIO.new(str)
21 21 output = PsuedoOutput.new
22   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  22 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
23 23 output.should include("1, MediaController#show")
24 24 end
25 25
@@ -37,7 +37,7 @@ module Oink::Reports
37 37
38 38 io = StringIO.new(str)
39 39 output = PsuedoOutput.new
40   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  40 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
41 41 output.should_not include("1, MediaController#show")
42 42 end
43 43
@@ -56,7 +56,7 @@ module Oink::Reports
56 56
57 57 io = StringIO.new(str)
58 58 output = PsuedoOutput.new
59   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  59 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
60 60 output.should include("2, MediaController#show")
61 61 end
62 62
@@ -78,7 +78,7 @@ module Oink::Reports
78 78
79 79 io = StringIO.new(str)
80 80 output = PsuedoOutput.new
81   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  81 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
82 82 output[-2].should == "2, MediaController#show"
83 83 output[-1].should == "1, Users#show"
84 84 end
@@ -97,7 +97,7 @@ module Oink::Reports
97 97
98 98 io = StringIO.new(str)
99 99 output = PsuedoOutput.new
100   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  100 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
101 101 output.should_not include("1, MediaController#show")
102 102 end
103 103
@@ -113,7 +113,7 @@ module Oink::Reports
113 113
114 114 io = StringIO.new(str)
115 115 output = PsuedoOutput.new
116   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  116 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
117 117 output.should_not include("1, MediaController#show")
118 118 end
119 119
@@ -131,7 +131,7 @@ module Oink::Reports
131 131
132 132 io = StringIO.new(str)
133 133 output = PsuedoOutput.new
134   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  134 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
135 135 output.should include("1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show")
136 136 end
137 137
@@ -147,7 +147,7 @@ module Oink::Reports
147 147
148 148 io = StringIO.new(str)
149 149 output = PsuedoOutput.new
150   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  150 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
151 151 output.should_not include("1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show")
152 152 end
153 153
@@ -166,7 +166,7 @@ module Oink::Reports
166 166
167 167 io = StringIO.new(str)
168 168 output = PsuedoOutput.new
169   - MemoryUsageReporter.new(io, TEN_MEGS).print(output)
  169 + MemoryUsageReport.new(io, TEN_MEGS).print(output)
170 170 output[4].should == "1. Feb 01 01:58:34, #{TEN_MEGS + 1} KB, MediaController#show"
171 171 output[5].should == "2. Feb 01 01:58:37, #{TEN_MEGS + 1} KB, DetailsController#show"
172 172 end
@@ -185,7 +185,7 @@ module Oink::Reports
185 185 #
186 186 # io = StringIO.new(str)
187 187 # output = PsuedoOutput.new
188   - # MemoryUsageReporter.new(io, TEN_MEGS).each_line do |line|
  188 + # MemoryUsageReport.new(io, TEN_MEGS).each_line do |line|
189 189 # output << line
190 190 # end
191 191 # output.first.should == "Feb 01 01:58:29 - Mar 13 03:58:30"
@@ -207,7 +207,7 @@ module Oink::Reports
207 207 STR
208 208 io = StringIO.new(str)
209 209 output = PsuedoOutput.new
210   - MemoryUsageReporter.new(io, TEN_MEGS, :format => :verbose).print(output)
  210 + MemoryUsageReport.new(io, TEN_MEGS, :format => :verbose).print(output)
211 211 output[3..6].should == str.split("\n")[4..7].map { |o| o.strip }
212 212 end
213 213
@@ -228,7 +228,7 @@ module Oink::Reports
228 228
229 229 io = StringIO.new(str)
230 230 output = PsuedoOutput.new
231   - MemoryUsageReporter.new(io, TEN_MEGS, :format => :verbose).print(output)
  231 + MemoryUsageReport.new(io, TEN_MEGS, :format => :verbose).print(output)
232 232 output[3..5].should == str.split("\n")[6..8].map { |o| o.strip }
233 233 end
234 234 end
@@ -257,7 +257,7 @@ module Oink::Reports
257 257 io1 = StringIO.new(str1)
258 258 io2 = StringIO.new(str2)
259 259 output = PsuedoOutput.new
260   - MemoryUsageReporter.new([io1, io2], TEN_MEGS).print(output)
  260 + MemoryUsageReport.new([io1, io2], TEN_MEGS).print(output)
261 261 output.should include("2, MediaController#show")
262 262 end
263 263

0 comments on commit 8db061d

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