Class: Profiler
Class Method Summary collapse
Class Method Details
.profile(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/watirmark/profile.rb', line 4 def self.profile(={}) RubyProf.start beginning = Time.now puts '-----------------------' puts [:name] puts '-----------------------' yield result = RubyProf.stop result.eliminate_methods!([/IO/, /Net::/, /Global/]) printer = RubyProf::FlatPrinter.new(result) printer.print(STDOUT, :min_percent=> ([:min_percent] || 1)) puts "----> Time elapsed #{Time.now - beginning} seconds" end |