Skip to content

Instantly share code, notes, and snippets.

@olegantonyan
Created January 11, 2019 16:51
Show Gist options
  • Save olegantonyan/fd1b68b85609ab8e3272912a60044184 to your computer and use it in GitHub Desktop.
Save olegantonyan/fd1b68b85609ab8e3272912a60044184 to your computer and use it in GitHub Desktop.

Revisions

  1. olegantonyan created this gist Jan 11, 2019.
    6 changes: 6 additions & 0 deletions ruby benchmark with CLOCK_MONOTONIC
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    def benchmark(what)
    start = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
    yield
    finish = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
    puts "#{what} took #{finish - start} seconds"
    end