Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8475

Show
Ignore:
Timestamp:
12/22/07 02:15:59 (10 months ago)
Author:
bitsweat
Message:

Request profiler resets after warmup and each run so you don't have to do it in your session script.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/request_profiler.rb

    r8474 r8475  
    2424          n.times do |i| 
    2525            run 
    26             print i % 10 == 0 ? 'x' : '.' 
    27             $stdout.flush 
     26            reset! 
     27            print_progress(i) 
    2828          end 
    2929        end 
     
    4242          script = File.read(script_path) 
    4343          instance_eval "def run; #{script}; end", script_path, 1 
     44        end 
     45 
     46        def print_progress(i) 
     47          print "\n  " if i % 60 == 0 
     48          print ' ' if i % 10 == 0 
     49          print '.' 
     50          $stdout.flush 
    4451        end 
    4552    end 
     
    8895 
    8996    def warmup(sandbox) 
    90       Benchmark.realtime { sandbox.run } 
     97      Benchmark.realtime do 
     98        sandbox.run 
     99        sandbox.reset! 
     100      end 
    91101    end 
    92102