To edit pages or tickets please login with username/password: aaf/aaf

Changeset 273

Show
Ignore:
Timestamp:
11/17/07 20:52:10 (11 months ago)
Author:
jk
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demo/test/smoke/drb_smoke_test.rb

    r272 r273  
    7474    def initialize(id) 
    7575      @id = id 
    76       @t1 = Time.now 
     76      @time = 0 
    7777    end 
    7878 
     
    8383    end 
    8484 
     85    def benchmark 
     86      t = Time.now 
     87      yield 
     88      Time.now - t 
     89    end 
     90 
    8591  end 
    8692 
     
    8894    def run 
    8995      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 
    9199        if i % NUM_RECORDS_PER_LOGENTRY == 0 
    92100          # 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}" 
    95102          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 
    97104                        :open_connections => Monitor::count_connections 
    98105        end 
     
    105112    def run 
    106113      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 
    110118        Stats.create! :process_id => @id, :kind => 'search', :info => "total_hits: #{result.total_hits} ; results: #{result.size}",  
    111119                      :processing_time => time * 1000, 
     
    136144      end 
    137145 
    138       while true  
     146      while Monitor::running? 
    139147        puts "open connections: #{Monitor::count_connections}; time elapsed: #{Time.now - @start} seconds" 
    140148        sleep 10  

To edit pages or tickets please login with username/password: aaf/aaf