[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

find out the time used for searching a file

Li Chen

10/23/2006 2:47:00 AM

Hi all,

When I run a script to search some files in a folder and/or its children
folders I want know how long it takes when the search is done. Is there
any such method available in Ruby ?

Thanks,

Li

--
Posted via http://www.ruby-....

2 Answers

Gavin Kistner

10/23/2006 5:21:00 AM

0

Li Chen wrote:
> When I run a script to search some files in a folder and/or its children
> folders I want know how long it takes when the search is done. Is there
> any such method available in Ruby ?

a) Research the Benchmark library
b)
start_time = Time.new
# do stuff here
end_time = Time.new
puts( "It took #{end_time - start_time} seconds" )

Scott

10/23/2006 5:58:00 AM

0

require 'benchmark'

seconds = Benchmark.realtime do
#do stuff here
end

Li Chen wrote:
> Hi all,
>
> When I run a script to search some files in a folder and/or its children
> folders I want know how long it takes when the search is done. Is there
> any such method available in Ruby ?
>
> Thanks,
>
> Li
>
> --
> Posted via http://www.ruby-....