class ImgFetcher::Stats
Attributes
retrieved_images[R]
total_lines[R]
Public Class Methods
new()
click to toggle source
# File lib/img_fetcher/stats.rb, line 5 def initialize @total_lines = 0 @retrieved_images = 0 @semaphore = Mutex.new @start_time = nil @end_time = nil end
Public Instance Methods
add_line()
click to toggle source
# File lib/img_fetcher/stats.rb, line 13 def add_line @semaphore.synchronize do @total_lines += 1 end end
add_retrieved_image()
click to toggle source
# File lib/img_fetcher/stats.rb, line 19 def add_retrieved_image @semaphore.synchronize do @retrieved_images += 1 end end
end()
click to toggle source
# File lib/img_fetcher/stats.rb, line 29 def end @end_time = now end
start()
click to toggle source
# File lib/img_fetcher/stats.rb, line 25 def start @start_time = now end
total_time()
click to toggle source
# File lib/img_fetcher/stats.rb, line 33 def total_time @end_time - @start_time end
Private Instance Methods
now()
click to toggle source
# File lib/img_fetcher/stats.rb, line 39 def now Process.clock_gettime(Process::CLOCK_MONOTONIC) end