Class: Nanoc::CLI::Commands::Compile::TimingRecorder
- Inherits:
-
Listener
- Object
- Listener
- Nanoc::CLI::Commands::Compile::TimingRecorder
- Defined in:
- lib/nanoc/cli/commands/compile.rb
Overview
Records the time spent per filter and per item representation
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (TimingRecorder) initialize(params = {})
constructor
A new instance of TimingRecorder.
-
- (Object) start
-
- (Object) stop
Constructor Details
- (TimingRecorder) initialize(params = {})
Returns a new instance of TimingRecorder
157 158 159 160 161 |
# File 'lib/nanoc/cli/commands/compile.rb', line 157 def initialize(params = {}) @times = {} @reps = params.fetch(:reps) end |
Class Method Details
+ (Boolean) enable_for?(command_runner)
152 153 154 |
# File 'lib/nanoc/cli/commands/compile.rb', line 152 def self.enable_for?(command_runner) command_runner..fetch(:verbose, false) end |
Instance Method Details
- (Object) start
164 165 166 167 168 169 170 171 172 |
# File 'lib/nanoc/cli/commands/compile.rb', line 164 def start Nanoc::NotificationCenter.on(:filtering_started) do |_rep, filter_name| @times[filter_name] ||= [] @times[filter_name] << { start: Time.now } end Nanoc::NotificationCenter.on(:filtering_ended) do |_rep, filter_name| @times[filter_name].last[:stop] = Time.now end end |
- (Object) stop
175 176 177 178 |
# File 'lib/nanoc/cli/commands/compile.rb', line 175 def stop print_profiling_feedback super end |