U:RDoc::NormalModule[iI"Profiler__:EF@0o:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"=Profile provides a way to Profile your Ruby application.;To:RDoc::Markup::BlankLineo; ;[I"QProfiling your program is a way of determining which methods are called and ;TI"Lhow long each method takes to complete. This way you can detect which ;TI"&methods are possible bottlenecks.;T@o; ;[I"MProfiling your program will slow down your execution time considerably, ;TI"Lso activate it only when you need it. Don't confuse benchmarking with ;TI"profiling.;T@o; ;[I".There are two ways to activate Profiling:;T@S:RDoc::Markup::Heading: leveli: textI"Command line;T@o; ;[I"6Run your Ruby script with -rprofile:;T@o:RDoc::Markup::Verbatim;[I"ruby -rprofile example.rb ;T: @format0o; ;[I"NIf you're profiling an executable in your $PATH you can use ;TI"ruby -S:;T@o;;[I"'ruby -rprofile -S some_executable ;T;0S; ; i; I"From code;T@o; ;[I"Just require 'profile':;T@o;;[I"require 'profile' ;TI" ;TI"def slow_method ;TI" 5000.times do ;TI"$ 9999999999999999*999999999 ;TI" end ;TI" end ;TI" ;TI"def fast_method ;TI" 5000.times do ;TI"$ 9999999999999999+999999999 ;TI" end ;TI" end ;TI" ;TI"slow_method ;TI"fast_method ;T;0o; ;[I"EThe output in both cases is a report when the execution is over:;T@o;;[I"ruby -rprofile example.rb ;TI" ;TI"9 % cumulative self self total ;TI"@ time seconds seconds calls ms/call ms/call name ;TI"I 68.42 0.13 0.13 2 65.00 95.00 Integer#times ;TI"D 15.79 0.16 0.03 5000 0.01 0.01 Fixnum#* ;TI"D 15.79 0.19 0.03 5000 0.01 0.01 Fixnum#+ ;TI"K 0.00 0.19 0.00 2 0.00 0.00 IO#set_encoding ;TI"N 0.00 0.19 0.00 1 0.00 100.00 Object#slow_method ;TI"O 0.00 0.19 0.00 2 0.00 0.00 Module#method_added ;TI"N 0.00 0.19 0.00 1 0.00 90.00 Object#fast_method ;TI"D 0.00 0.19 0.00 1 0.00 190.00 #toplevel;T;0: @fileI"lib/profiler.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[;[[I"print_profile;FI"lib/profiler.rb;T[I"start_profile;F@i[I"stop_profile;F@i[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[I"lib/profile.rb;T@T@TcRDoc::TopLevel