Is it possible in Ruby/Rails to measure the actual execution time of a single thread, within a multi-threaded environment?
I am creating up to 10 threads at once, and I am currently calculating the elapsed time for each thread, but since the multiple threads are sharing the processor(s), there will be gaps in as they share resources. So my time is going to be more than actual.
@urls.each do |url|
Thread.new do
time = Time.now
request = http.get(url)
response_time = Time.now - time
end
...
end
wycats has made a cool gem called ruby-prof that should help you. It supports profiling multiple threads simultaneously, including process time, cpu time, and wall time.