Class: Statistics

Inherits:
Object
  • Object
show all
Defined in:
lib/gsv_downloader/statistics.rb

Overview

Optional Statistics

  • number of processed events

  • speed/seconds

Instance Method Summary collapse

Constructor Details

#initializeStatistics

Returns a new instance of Statistics.



5
6
7
8
# File 'lib/gsv_downloader/statistics.rb', line 5

def initialize()
	@processed = 0
	reset_speed_session
end

Instance Method Details

#countObject



24
25
26
27
28
29
30
31
# File 'lib/gsv_downloader/statistics.rb', line 24

def count
   if (@processed % 100) == 0
     puts "#{@processed} GSV Images processed (speed: #{speed}/s)"
     reset_speed_session
   end
 	@processed += 1
	@session_count += 1
end

#processedObject



10
11
12
# File 'lib/gsv_downloader/statistics.rb', line 10

def processed
	@processed
end

#reset_speed_sessionObject



14
15
16
17
# File 'lib/gsv_downloader/statistics.rb', line 14

def reset_speed_session
	 @start_time = Time.now
	 @session_count = 0
end

#speedObject



19
20
21
22
# File 'lib/gsv_downloader/statistics.rb', line 19

def speed
	time = Time.now - @start_time
	@session_count.to_f / time.to_f
end