From 624d5bb176de5212bea43a1c57a95f48676c6e9f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 14 Apr 2005 08:23:50 +0000 Subject: Added script/benchmarker to easily benchmark one or more statement a number of times from within the environment. Added script/profiler to easily profile a single statement from within the environment git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1166 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/bin/profiler | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 railties/bin/profiler (limited to 'railties/bin/profiler') diff --git a/railties/bin/profiler b/railties/bin/profiler new file mode 100644 index 0000000000..aca84055c2 --- /dev/null +++ b/railties/bin/profiler @@ -0,0 +1,14 @@ +#!/usr/local/bin/ruby + +if ARGV.empty? + puts "Usage: profiler 'Person.expensive_method(10)' [times]" + exit +end + +require File.dirname(__FILE__) + '/../config/environment' +require "profiler" + +Profiler__::start_profile +(ARGV[1] || 1).to_i.times { eval(ARGV.first) } +Profiler__::stop_profile +Profiler__::print_profile($stdout) \ No newline at end of file -- cgit v1.2.3