/usr/lib/ruby/1.8/ramaze/contrib/profiling.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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
|