Class: Holistic::Ruby::Parser::PerformanceMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/holistic/ruby/parser.rb

Instance Method Summary collapse

Constructor Details

#initializePerformanceMetrics

Returns a new instance of PerformanceMetrics.



27
28
29
30
31
# File 'lib/holistic/ruby/parser.rb', line 27

def initialize
  @amount_of_files  = 0
  @total_read_time  = 0
  @total_parse_time = 0
end

Instance Method Details

#end_file_read!Object



38
39
40
# File 'lib/holistic/ruby/parser.rb', line 38

def end_file_read!
  @total_read_time += ::Process.clock_gettime(Process::CLOCK_MONOTONIC) - @file_read_before
end

#end_parse!Object



46
47
48
# File 'lib/holistic/ruby/parser.rb', line 46

def end_parse!
  @total_parse_time += ::Process.clock_gettime(Process::CLOCK_MONOTONIC) - @parse_before
end

#inspectObject



50
51
52
53
54
55
56
# File 'lib/holistic/ruby/parser.rb', line 50

def inspect
  {
    amount_of_files:  @amount_of_files,
    total_read_time:  @total_read_time,
    total_parse_time: @total_parse_time
  }.inspect
end

#start_file_read!Object



33
34
35
36
# File 'lib/holistic/ruby/parser.rb', line 33

def start_file_read!
  @amount_of_files += 1
  @file_read_before = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
end

#start_parse!Object



42
43
44
# File 'lib/holistic/ruby/parser.rb', line 42

def start_parse!
  @parse_before = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
end