more instrumenting

This commit is contained in:
Thomas Reynolds 2014-08-24 15:49:53 -07:00
parent c3492b1f7b
commit 6ef96cc15a
2 changed files with 4 additions and 2 deletions

View file

@ -75,7 +75,9 @@ module Middleman
end end
# Render using Tilt # Render using Tilt
content = template.render(context, locs, &block) content = ::Middleman::Util.instrument 'render.tilt', path: path do
template.render(context, locs, &block)
end
# Allow hooks to manipulate the result after render # Allow hooks to manipulate the result after render
@app.class.callbacks_for_hook(:after_render).each do |callback| @app.class.callbacks_for_hook(:after_render).each do |callback|

View file

@ -40,7 +40,7 @@ module Middleman
return if @instrumenting.is_a?(String) && @instrumenting != 'instrument' && !message.include?(@instrumenting) return if @instrumenting.is_a?(String) && @instrumenting != 'instrument' && !message.include?(@instrumenting)
evt = ActiveSupport::Notifications::Event.new(message, *args) evt = ActiveSupport::Notifications::Event.new(message, *args)
info "== Instrument (#{evt.name.sub(/.middleman$/, '')}): #{evt.duration}ms" info "== Instrument (#{evt.name.sub(/.middleman$/, '')}): #{evt.duration}ms\n#{args.last}"
end end
end end
end end