require 'active_support/core_ext/module/attr_internal' module Scrivito module ControllerRuntime extend ActiveSupport::Concern protected attr_internal :rc_runtime def cleanup_view_runtime rc_rt_before_render = Scrivito::LogSubscriber.reset_runtime runtime = super rc_rt_after_render = Scrivito::LogSubscriber.reset_runtime self.rc_runtime = rc_rt_before_render + rc_rt_after_render runtime - rc_rt_after_render end def append_info_to_payload(payload) super payload[:rc_runtime] = rc_runtime end module ClassMethods def log_process_action(payload) messages, rc_runtime = super, payload[:rc_runtime] messages << ("Scrivito: %.1fms" % rc_runtime.to_f) messages end end end end # module Scrivito