Class: Nanoc::CLI::Commands::Compile::StackProfProfiler
- Inherits:
-
Listener
- Object
- Listener
- Nanoc::CLI::Commands::Compile::StackProfProfiler
show all
- Defined in:
- lib/nanoc/cli/commands/compile.rb
Overview
Records a profile using StackProf
Constant Summary
- PROFILE_FILE =
'tmp/stackprof_profile'.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Listener
#initialize
Class Method Details
.enable_for?(command_runner) ⇒ Boolean
375
376
377
|
# File 'lib/nanoc/cli/commands/compile.rb', line 375
def self.enable_for?(command_runner)
command_runner.options.fetch(:profile, false)
end
|
Instance Method Details
#start ⇒ Object
380
381
382
383
|
# File 'lib/nanoc/cli/commands/compile.rb', line 380
def start
require 'stackprof'
StackProf.start(mode: :cpu)
end
|
#stop ⇒ Object
386
387
388
389
|
# File 'lib/nanoc/cli/commands/compile.rb', line 386
def stop
StackProf.stop
StackProf.results(PROFILE_FILE)
end
|