Module: RuntimeProfiler

Includes:
ActiveSupport::Configurable
Defined in:
lib/runtime_profiler.rb,
lib/runtime_profiler/cli.rb,
lib/runtime_profiler/version.rb,
lib/runtime_profiler/profiler.rb,
lib/runtime_profiler/text_report.rb,
lib/runtime_profiler/events/sql_event.rb,
lib/runtime_profiler/instrumentation_data.rb,
lib/runtime_profiler/callbacks/active_record.rb,
lib/runtime_profiler/callbacks/action_controller.rb,
lib/runtime_profiler/events/process_action_event.rb

Defined Under Namespace

Modules: Callback Classes: CLI, InstrumentationData, ProcessActionEvent, Profiler, SqlEvent, TextReport

Constant Summary collapse

VERSION =
'0.4.1'.freeze

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



34
35
36
37
38
39
40
41
# File 'lib/runtime_profiler.rb', line 34

def configure
  begin
    Rails.application.eager_load!
  rescue StandardError
    nil
  end
  yield self if block_given?
end

.profile!(key, konstants) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/runtime_profiler.rb', line 43

def profile!(key, konstants)
  konstants = konstants.is_a?(Array) ? konstants : [konstants]
  profiler = Profiler.new(konstants)
  profiler.prepare_for_instrumentation

  MethodMeter.measure!(key) { yield }

  profiler.save_instrumentation_data
end