Module: Ruby2D::Benchmark::PresentTimer

Defined in:
lib/ruby2d/benchmark.rb

Overview

Wraps Ext.end_frame to accumulate present time. Prepended to the Ext singleton in run. The extra Ext.now reads are sub-microsecond and apply to every benchmark equally, so A/B comparisons stay consistent.

Instance Method Summary collapse

Instance Method Details

#end_frame(*args) ⇒ Object



43
44
45
46
47
48
# File 'lib/ruby2d/benchmark.rb', line 43

def end_frame(*args)
  t = Ext.now
  super
ensure
  Clock.present_ns += Ext.now - t
end