Class: GitLab::Monitor::TimeTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab_monitor/util.rb

Overview

Time tracking object

Provides a simple time tracking, and returns back the result plus the tracked time wraped in a TrackedResult struct

Instance Method Summary collapse

Instance Method Details

#trackObject



17
18
19
20
21
# File 'lib/gitlab_monitor/util.rb', line 17

def track
  @start = Time.now.to_f
  result = yield
  TrackedResult.new(result, Time.now.to_f - @start)
end