Class: EZmetrics::Benchmark

Inherits:
Object
  • Object
show all
Defined in:
lib/ezmetrics/benchmark.rb

Instance Method Summary collapse

Constructor Details

#initialize(store_each_value = false) ⇒ Benchmark

Returns a new instance of Benchmark.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ezmetrics/benchmark.rb', line 5

def initialize(store_each_value=false)
  @store_each_value = store_each_value
  @start            = Time.now.to_i
  @redis            = Redis.new(driver: :hiredis)
  @durations        = []
  @iterations       = 1
  @intervals        = {
    "1.minute" => 60,
    "1.hour  " => 3600,
    "12.hours" => 43200,
    "24.hours" => 86400,
    "48.hours" => 172800
  }
end

Instance Method Details

#measure_aggregation(partition_by = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/ezmetrics/benchmark.rb', line 20

def measure_aggregation(partition_by=nil)
  write_metrics
  print_header
  intervals.each do |interval, seconds|
    result = measure_aggregation_time(interval, seconds, partition_by)
    print_row(result)
  end
  cleanup_metrics
  print_footer
end