Sha256: ade5ddbb31107000c0f838af156df8675829af9d6930789bc1b7f4df3a7a643a
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Speedup module Collectors class RubyprofCollector < Collector def initialize(options={}) require 'ruby-prof' @results_dir = Rails.root.join('tmp', 'rubyprof') Dir.mkdir( @results_dir ) unless File.directory?(@results_dir) super end def parse_options # pass end # The data results that are inserted at the end of the request for use in # deferred placeholders in the Peek the bar. # # Returns Hash. def results {} end def setup_subscribes before_request do RubyProf.start if enabled? end after_request do result = RubyProf.stop if enabled? # Print a flat profile to text printer = RubyProf::GraphHtmlPrinter.new(result) ::File.open(@results_dir.join( Speedup.request.id ), 'wb') do |file| printer.print(file) end end end def filter_event?(evt) super || evt.payload[:controller].start_with?('Speedup') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
speedup-rails-0.0.7 | lib/speedup/collectors/rubyprof_collector.rb |
speedup-rails-0.0.6 | lib/speedup/collectors/rubyprof_collector.rb |