Skip to content

Commit

Permalink
Merge pull request #1122 from nanoc/no-avg
Browse files Browse the repository at this point in the history
Show percentiles rather than average
  • Loading branch information
denisdefreyne committed Mar 17, 2017
2 parents 11127d7 + e2f6940 commit 24b8378
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb
Expand Up @@ -107,16 +107,18 @@ def stop
protected

def table_for_summary(name)
headers = [name.to_s, 'count', 'min', 'avg', 'max', 'tot']
headers = [name.to_s, 'count', 'min', '.50', '.90', '.95', 'max', 'tot']

rows = @telemetry.summary(name).map do |filter_name, summary|
count = summary.count
min = summary.min
avg = summary.avg
p50 = summary.quantile(0.50)
p90 = summary.quantile(0.90)
p95 = summary.quantile(0.95)
tot = summary.sum
max = summary.max

[filter_name, count.to_s] + [min, avg, max, tot].map { |r| "#{format('%4.2f', r)}s" }
[filter_name, count.to_s] + [min, p50, p90, p95, max, tot].map { |r| "#{format('%4.2f', r)}s" }
end

[headers] + rows
Expand Down
4 changes: 2 additions & 2 deletions spec/nanoc/cli/commands/compile/timing_recorder_spec.rb
Expand Up @@ -40,7 +40,7 @@
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)

expect { listener.stop }
.to output(/^\s*erb │ 2 1\.00s 1\.50s 2\.00s 3\.00s$/).to_stdout
.to output(/^\s*erb │ 2 1\.00s 1\.50s 1\.90s 1\.95s 2\.00s 3\.00s$/).to_stdout
end

it 'records single from filtering_started to filtering_ended' do
Expand Down Expand Up @@ -228,7 +228,7 @@
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_ended, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)

expect { listener.stop }
.to output(/^\s*CodeSnippetsModified │ 1 1\.00s 1\.00s 1\.00s 1\.00s$/).to_stdout
.to output(/^\s*CodeSnippetsModified │ 1 1\.00s 1\.00s 1\.00s 1\.00s 1\.00s 1\.00s$/).to_stdout
end

it 'records single outdatedness rule duration' do
Expand Down

0 comments on commit 24b8378

Please sign in to comment.