#!/usr/bin/env ruby

if ARGV.length == 0 || ARGV.length > 3 || ARGV.first == 'help'
  $stderr.puts "usage: perf_run iterations options [conf-name]"
  $stderr.puts "example: perf_run 100 \"-bm=default -log\" pdata"
  exit 1
end

bindir = File.dirname(__FILE__)
require "#{bindir}/../lib/railsbench/perf_utils"

determine_rails_root_or_die!

iterations = ARGV[0]
options = ARGV[1]

benchmark = "default"
benchmark = $1 if options =~ /-bm=([^ ]+)/

benchmark_file = benchmark_file_name(benchmark, ARGV[2])
perf_run("perf_run", iterations, options, benchmark_file)

__END__

#  Copyright (C) 2005-2008  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
