U:RDoc::AnyMethod[iI"benchmark:EFI"Benchmark::benchmark;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I">Invokes the block with a Benchmark::Report object, which ;TI"Dmay be used to collect and report on the results of individual ;TI"@benchmark tests. Reserves +label_width+ leading spaces for ;TI"=labels on each line. Prints +caption+ at the top of the ;TI"4report, and uses +format+ to format each line. ;TI"0Returns an array of Benchmark::Tms objects.;To:RDoc::Markup::BlankLineo; ; [ I"&If the block returns an array of ;TI":Benchmark::Tms objects, these will be used to format ;TI";additional lines of output. If +labels+ parameter are ;TI"6given, these are used to label these extra lines.;T@o; ; [I"L_Note_: Other methods provide a simpler interface to this one, and are ;TI"Msuitable for nearly all benchmarking requirements. See the examples in ;TI".Benchmark, and the #bm and #bmbm methods.;T@o; ; [I" Example:;T@o:RDoc::Markup::Verbatim; [I"require 'benchmark' ;TI"Kinclude Benchmark # we need the CAPTION and FORMAT constants ;TI" ;TI"n = 5000000 ;TI"HBenchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| ;TI"? tf = x.report("for:") { for i in 1..n; a = "1"; end } ;TI"? tt = x.report("times:") { n.times do ; a = "1"; end } ;TI"? tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } ;TI" [tf+tt+tu, (tf+tt+tu)/3] ;TI" end ;T: @format0o; ; [I"Generates:;T@o; ; [ I": user system total real ;TI";for: 0.970000 0.000000 0.970000 ( 0.970493) ;TI";times: 0.990000 0.000000 0.990000 ( 0.989542) ;TI";upto: 0.970000 0.000000 0.970000 ( 0.972854) ;TI";>total: 2.930000 0.000000 2.930000 ( 2.932889) ;TI":>avg: 0.976667 0.000000 0.976667 ( 0.977630);T; 0: @fileI"lib/benchmark.rb;T:0@omit_headings_from_table_of_contents_below00I" report;F[I"=(caption = "", label_width = nil, format = nil, *labels);T@9FI"Benchmark;FcRDoc::NormalModule00