Module: TestProf::EventProf
- Defined in:
- lib/test_prof/event_prof.rb,
lib/test_prof/event_prof/rspec.rb,
lib/test_prof/event_prof/instrumentations/active_support.rb
Overview
EventProf profiles your tests and suites against custom events, such as ActiveSupport::Notifacations.
It works very similar to ‘rspec –profile` but can track arbitrary events.
Example:
# Collect SQL queries stats for every suite and example
EVENT_PROF='sql.active_record' rspec ...
By default it collects information only about top-level groups (aka suites), but you can also profile individual examples. Just set the configuration option:
TestProf::EventProf.configure do |config|
config.per_example = true
end
Or provide the EVENT_PROF_EXAMPLES=1 env variable.
Defined Under Namespace
Modules: CustomEvents, Instrumentations Classes: Configuration, Profiler, RSpecListener
Class Method Summary collapse
-
.build ⇒ Object
Returns new configured instance of profiler.
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
Class Method Details
.build ⇒ Object
Returns new configured instance of profiler
76 77 78 79 80 81 |
# File 'lib/test_prof/event_prof.rb', line 76 def build Profiler.new( event: config.event, instrumenter: config.resolve_instrumenter ) end |
.config ⇒ Object
67 68 69 |
# File 'lib/test_prof/event_prof.rb', line 67 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
71 72 73 |
# File 'lib/test_prof/event_prof.rb', line 71 def configure yield config end |