Class: DeepTest::Distributed::ThroughputStatistics

Inherits:
Object
  • Object
show all
Defined in:
lib/deep_test/distributed/throughput_statistics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_count, start_time, end_time) ⇒ ThroughputStatistics

Returns a new instance of ThroughputStatistics.



6
7
8
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 6

def initialize(test_count, start_time, end_time)
  @test_count, @start_time, @end_time = test_count, start_time, end_time
end

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



4
5
6
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 4

def end_time
  @end_time
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



4
5
6
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 4

def start_time
  @start_time
end

#test_countObject (readonly)

Returns the value of attribute test_count.



4
5
6
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 4

def test_count
  @test_count
end

Instance Method Details

#summaryObject



18
19
20
21
22
23
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 18

def summary
  <<-end_summary
#{test_count} tests run in #{timespan_in_seconds} seconds
(#{tests_per_second} tests / second)
  end_summary
end

#tests_per_secondObject



14
15
16
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 14

def tests_per_second
  @test_count / timespan_in_seconds
end

#timespan_in_secondsObject



10
11
12
# File 'lib/deep_test/distributed/throughput_statistics.rb', line 10

def timespan_in_seconds
  @end_time.to_f - @start_time.to_f
end