Class: Datadog::Profiling::Profiler
- Inherits:
-
Object
- Object
- Datadog::Profiling::Profiler
- Includes:
- Core::Utils::Forking
- Defined in:
- lib/datadog/profiling/profiler.rb
Overview
Profiling entry point, which coordinates collectors and a scheduler
Instance Attribute Summary collapse
-
#collectors ⇒ Object
readonly
Returns the value of attribute collectors.
-
#scheduler ⇒ Object
readonly
Returns the value of attribute scheduler.
Instance Method Summary collapse
-
#initialize(collectors, scheduler) ⇒ Profiler
constructor
A new instance of Profiler.
- #shutdown! ⇒ Object
- #start ⇒ Object
Methods included from Core::Utils::Forking
#after_fork!, extended, #fork_pid, #forked?, included, #update_fork_pid!
Constructor Details
#initialize(collectors, scheduler) ⇒ Profiler
Returns a new instance of Profiler.
11 12 13 14 |
# File 'lib/datadog/profiling/profiler.rb', line 11 def initialize(collectors, scheduler) @collectors = collectors @scheduler = scheduler end |
Instance Attribute Details
#collectors ⇒ Object (readonly)
Returns the value of attribute collectors.
7 8 9 |
# File 'lib/datadog/profiling/profiler.rb', line 7 def collectors @collectors end |
#scheduler ⇒ Object (readonly)
Returns the value of attribute scheduler.
7 8 9 |
# File 'lib/datadog/profiling/profiler.rb', line 7 def scheduler @scheduler end |
Instance Method Details
#shutdown! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/profiling/profiler.rb', line 26 def shutdown! Datadog.logger.debug('Shutting down profiler') collectors.each do |collector| collector.enabled = false collector.stop(true) end scheduler.enabled = false scheduler.stop(true) end |
#start ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/datadog/profiling/profiler.rb', line 16 def start after_fork! do collectors.each(&:reset_after_fork) scheduler.reset_after_fork end collectors.each(&:start) scheduler.start end |