Sha256: b5528fe40a05af2326dcaebdf6c10a985299d12e76fded25e2f24e7ff90c2ad6

Contents?: true

Size: 519 Bytes

Versions: 8

Compression:

Stored size: 519 Bytes

Contents

$:.unshift File.expand_path("../../lib", __FILE__)

require 'ruby-prof'
require 'fileutils'

require 'daru'

def __profile__(name = nil)
  # infers name to be "sorting" when called from "profile/sorting.rb:10:in `<main>'"
  name ||= caller.first.split(':').first.split('/').last.sub('.rb', '')

  path = File.expand_path("../out/#{name}.html", __FILE__)
  FileUtils.mkdir_p File.dirname(path)

  RubyProf.start

  yield

  res = RubyProf.stop
  RubyProf::GraphHtmlPrinter.new(res)
    .print(File.open(path, 'w'))

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
daru-0.3 profile/_base.rb
daru-0.2.2 profile/_base.rb
daru-0.2.1 profile/_base.rb
daru-0.2.0 profile/_base.rb
daru-0.1.6 profile/_base.rb
daru-0.1.5 profile/_base.rb
daru-0.1.4.1 profile/_base.rb
daru-0.1.4 profile/_base.rb