Sha256: 9a9ff026ac7948d4c1497eeb2cf0d61a9ce0414153faae53e8437e4ce97ced36
Contents?: true
Size: 839 Bytes
Versions: 43
Compression:
Stored size: 839 Bytes
Contents
require "ruby-prof" module Ramaze class Dispatcher class ActionProfiler < Action def self.call(path) if RubyProf.running? super else result = RubyProf.profile { super } output = StringIO.new printer = RubyProf::FlatPrinter.new(result) options = { :min_percent => Contrib::Profiling.trait[:min_percent], :print_file => false } printer.print(output, options) output.string.split("\n").each do |line| Log.info(line) end end end end end module Contrib class Profiling trait :min_percent => 1 def self.startup Dispatcher::FILTER.delete(Dispatcher::Action) Dispatcher::FILTER << Dispatcher::ActionProfiler end end end end
Version data entries
43 entries across 43 versions & 5 rubygems