Sha256: f14f8e9b915c541a4dc0911c86a6e80d74e5e4128061ee38b6787843fa48dd95

Contents?: true

Size: 492 Bytes

Versions: 9

Compression:

Stored size: 492 Bytes

Contents

module Nanoc::CLI::Commands::CompileListeners
  class StackProfProfiler < Abstract
    PROFILE_FILE = 'tmp/stackprof_profile'.freeze

    # @see Listener#enable_for?
    def self.enable_for?(command_runner)
      command_runner.options.fetch(:profile, false)
    end

    # @see Listener#start
    def start
      require 'stackprof'
      StackProf.start(mode: :cpu)
    end

    # @see Listener#stop
    def stop
      StackProf.stop
      StackProf.results(PROFILE_FILE)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.8 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.7 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.6 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.5 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.4 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.3 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.2 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb
nanoc-4.7.1 lib/nanoc/cli/commands/compile_listeners/stack_prof_profiler.rb