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
164 165 166 167 168 |
# File 'lib/nanoc/cli/commands/compile.rb', line 164 def initialize(params = {}) @times = {} @reps = params.fetch(:reps) end |
Class Method Details
+ (Boolean) enable_for?(command_runner)
159 160 161 |
# File 'lib/nanoc/cli/commands/compile.rb', line 159 def self.enable_for?(command_runner) command_runner..fetch(:verbose, false) end |
Instance Method Details
- (Object) start
171 172 173 174 175 176 177 178 179 |
# File 'lib/nanoc/cli/commands/compile.rb', line 171 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
182 183 184 185 |
# File 'lib/nanoc/cli/commands/compile.rb', line 182 def stop print_profiling_feedback super end |