Class: MOSAIK::Time

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaik/time.rb

Overview

Time utilities

Class Method Summary collapse

Class Method Details

.measureObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mosaik/time.rb', line 8

def self.measure
  # Save start time
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  yield

  # Save end time
  end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  # Return execution time (in seconds)
  end_time - start_time
end