Class: Rubyboy::Bench

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

Instance Method Summary collapse

Instance Method Details

#bench(count: 3, frames: 1500, rom_path: 'lib/roms/tobu.gb') ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/bench.rb', line 14

def bench(count: 3, frames: 1500, rom_path: 'lib/roms/tobu.gb')
  time_sum = 0
  count.times do |i|
    time = Rubyboy::Emulator.new(rom_path).bench(frames)
    time_sum += time
    puts "#{i + 1}: #{time / 1_000_000_000.0} sec"
  end

  puts "FPS: #{frames * count * 1_000_000_000.0 / time_sum}"
end

#stackprofObject



8
9
10
11
12
# File 'lib/bench.rb', line 8

def stackprof
  StackProf.run(mode: :cpu, out: 'stackprof-cpu-myapp.dump', raw: true) do
    Rubyboy::Emulator.new('lib/roms/tobu.gb').bench
  end
end