Skip to content

Instantly share code, notes, and snippets.

View k41n's full-sized avatar

Andrei Malyshev k41n

View GitHub Profile
@k41n
k41n / prof.rb
Created September 8, 2017 12:01 — forked from teamon/prof.rb
Profile rails controller with ruby-prof
# gem "ruby-prof"
around_filter :profiler
def profiler(&block)
data = RubyProf::Profile.profile(&block)
filepath = Rails.root.join("tmp", "profiler.html")
File.open(filepath, "w") do |f|
RubyProf::CallStackPrinter.new(data).print(f)