#!/usr/bin/env ruby trap("INT") { $stderr.puts("benchmarking aborted!"); exit!(-1) } require File.dirname(__FILE__) + '/../lib/railsbench' require ENV['RAILS_ROOT'] + '/config/benchmarks' trap("INT") do $stderr.puts "clearing database connections ..." ActiveRecord::Base.send :clear_all_cached_connections! $stderr.puts "benchmarking aborted!" exit!(-1) end benchmarks = YAML::load(File.open(ENV['RAILS_ROOT'] + "/config/benchmarks.yml")) benchmark_name = "default" ARGV.each{ |arg| benchmark_name = $1 if arg =~ /-bm=([a-zA-Z_0-9]+)/ } RAILS_BENCHMARKER.iterations = ARGV[0].to_i RAILS_BENCHMARKER.url_spec = benchmarks RAILS_BENCHMARKER.setup_test_urls(benchmark_name) RAILS_BENCHMARKER.establish_test_session RAILS_BENCHMARKER.warmup if ARGV.include?('-warmup') RAILS_BENCHMARKER.run_urls_without_benchmark(ENV['RUBY_GC_STATS'].to_i == 1) __END__ ### Local Variables: *** ### mode:ruby *** ### End: *** # Copyright (C) 2005, 2006 Stefan Kaes # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA