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

Changeset 271

Show
Ignore:
Timestamp:
11/17/07 18:45:58 (1 year ago)
Author:
jk
Message:

smoke test with stats

Files:

Legend:

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

    r270 r271  
    88# AAF_REMOTE=true script/runner -e test test/smoke/drb_smoke_test.rb 
    99 
     10RECORDS_PER_PROCESS = 100000 
     11NUM_PROCESSES       = 10 
     12NUM_RECORDS_PER_LOGENTRY = 100 
    1013 
    1114class DrbSmokeTest 
     
    1316    @id = id 
    1417  end 
     18  def self.count_connections 
     19    res = Content.connection.execute("show status where variable_name = 'Threads_connected'") 
     20    if res 
     21      res.fetch_row.last 
     22    else 
     23      "error getting connection count" 
     24    end 
     25  end 
    1526  def run 
    16     500.times do |i| 
    17       Content.create! :title => "title #{i}", :description => "description #{i}" 
    18       if i % 100 == 0 
    19         puts "#{@id}: #{i} records indexed" 
     27    @t1 = Time.now 
     28    RECORDS_PER_PROCESS.times do |i| 
     29      Content.create! :title => "process #{@id}", :description => "record #{i}\n#{'Lorem ipsum. ' * 100 }" 
     30      if i % NUM_RECORDS_PER_LOGENTRY == 0 
     31        time = Time.now - @t1 
     32        puts "#{@id}: #{i} records indexed, last 100 in #{time}" 
     33        Stats.create! :process_id => @id, :records => NUM_RECORDS_PER_LOGENTRY, :processing_time => time, :open_connections => self.class.count_connections 
     34        @t1 = Time.now 
    2035      end 
    2136    end 
     
    2338end 
    2439 
    25 def count_connections 
    26   Content.connection.execute("show status where variable_name = 'Threads_connected'").fetch_row.last 
    27 end 
    2840 
    29 10.times do |i| 
     41#Content.delete_all 
     42 
     43@start = Time.now 
     44 
     45NUM_PROCESSES.times do |i| 
    3046  unless fork 
    3147    @id = i 
     
    3854else 
    3955  while true  
    40     puts "open connections: #{count_connections}
    41     sleep 5 
     56    puts "open connections: #{DrbSmokeTest::count_connections}; time elapsed: #{Time.now - @start} seconds
     57    sleep 10  
    4258  end 
    4359end 
     60 

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