Module: SimplestBenchmark

Includes:
SimplestBenchmarkLogger
Defined in:
lib/simplest_benchmark.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SimplestBenchmarkLogger

#custom_logger, #log

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/simplest_benchmark.rb', line 8

def logger
  @logger
end

#milisecondsObject

Returns the value of attribute miliseconds.



8
9
10
# File 'lib/simplest_benchmark.rb', line 8

def miliseconds
  @miliseconds
end

#rails_appObject

Returns the value of attribute rails_app.



8
9
10
# File 'lib/simplest_benchmark.rb', line 8

def rails_app
  @rails_app
end

Instance Method Details

#sb_begin(msg = "", other_info = "") ⇒ Object



10
11
12
13
14
# File 'lib/simplest_benchmark.rb', line 10

def sb_begin(msg = "", other_info = "")
  time        = Time.now
  miliseconds << time.to_f
  log "SimplestBenchmark\t#{time}\t#{time.to_f}\tBEGIN\t#{miliseconds.count-1}\t#{msg}\t\t#{other_info}"
end

#sb_end(msg, other_info = "") ⇒ Object



16
17
18
19
20
21
22
# File 'lib/simplest_benchmark.rb', line 16

def sb_end(msg, other_info="")
  time       = Time.now
  time_spent = time.to_f - miliseconds.last
  miliseconds.pop
  log "SimplestBenchmark\t#{time}\t#{time.to_f}\tEND\t#{miliseconds.count}\t#{msg}\t#{time_spent}\t#{other_info}"
  return time_spent
end