Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show percentiles rather than average #1122

Merged
merged 1 commit into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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