Sha256: a70a4b7e97becfb4a369c33d7f4a97924b6f749c4511ae7e47967415784d487e

Contents?: true

Size: 524 Bytes

Versions: 4

Compression:

Stored size: 524 Bytes

Contents

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

require 'ruby-prof'
require 'fileutils'

require 'daru_lite'

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

4 entries across 4 versions & 1 rubygems

Version Path
daru_lite-0.1.3 profile/_base.rb
daru_lite-0.1.2 profile/_base.rb
daru_lite-0.1.1 profile/_base.rb
daru_lite-0.1 profile/_base.rb