Skip to content

Commit

Permalink
Merge pull request #25 from nithinbekal/benchmark-realtime-docs
Browse files Browse the repository at this point in the history
Improve docs for Benchmark.realtime
  • Loading branch information
hsbt authored Sep 27, 2024
2 parents 0652906 + 0f278be commit c053675
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ def measure(label = "") # :yield:

#
# Returns the elapsed real time used to execute the given block.
# The unit of time is seconds.
#
# Benchmark.realtime { "a" * 1_000_000_000 }
# #=> 0.5098029999935534
#
def realtime # :yield:
r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
Expand Down

0 comments on commit c053675

Please sign in to comment.