aboutsummaryrefslogtreecommitdiffstats
path: root/railties/bin/profiler
diff options
context:
space:
mode:
Diffstat (limited to 'railties/bin/profiler')
-rw-r--r--railties/bin/profiler14
1 files changed, 14 insertions, 0 deletions
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