Changeset 273
- Timestamp:
- 11/17/07 20:52:10 (11 months ago)
- Files:
-
- trunk/demo/test/smoke/drb_smoke_test.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demo/test/smoke/drb_smoke_test.rb
r272 r273 74 74 def initialize(id) 75 75 @id = id 76 @t 1 = Time.now76 @time = 0 77 77 end 78 78 … … 83 83 end 84 84 85 def benchmark 86 t = Time.now 87 yield 88 Time.now - t 89 end 90 85 91 end 86 92 … … 88 94 def run 89 95 RECORDS_PER_PROCESS.times do |i| 90 Content.create! :title => "record #{@id} / #{i}", :description => DrbSmokeTest::random_document 96 @time += benchmark do 97 Content.create! :title => "record #{@id} / #{i}", :description => DrbSmokeTest::random_document 98 end 91 99 if i % NUM_RECORDS_PER_LOGENTRY == 0 92 100 # write stats 93 time = get_time 94 puts "#{@id}: #{i} records indexed, last #{NUM_RECORDS_PER_LOGENTRY} in #{time}" 101 puts "#{@id}: #{i} records indexed, last #{NUM_RECORDS_PER_LOGENTRY} in #{@time}" 95 102 Stats.create! :process_id => @id, :kind => 'write', :info => i, 96 :processing_time => time * TIME_FACTOR,103 :processing_time => @time * TIME_FACTOR, # average processing time per record in this batch 97 104 :open_connections => Monitor::count_connections 98 105 end … … 105 112 def run 106 113 while Monitor::running? 107 t = Time.now 108 result = Content.find_with_ferret 'findme', :lazy => true 109 time = Time.now - t 114 result = nil 115 time = benchmark do 116 result = Content.find_with_ferret 'findme', :lazy => true 117 end 110 118 Stats.create! :process_id => @id, :kind => 'search', :info => "total_hits: #{result.total_hits} ; results: #{result.size}", 111 119 :processing_time => time * 1000, … … 136 144 end 137 145 138 while true146 while Monitor::running? 139 147 puts "open connections: #{Monitor::count_connections}; time elapsed: #{Time.now - @start} seconds" 140 148 sleep 10
