Skip to content

Commit

Permalink
Update long_tail_hey.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Dec 1, 2024
1 parent 59f2a3b commit 4b194e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions benchmarks/local/long_tail_hey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,23 @@ def summary_puma_stats
str << format("#{@hey_run_data[k]} %6d %4d %5d %5d %5d",
requests.sum, reactor_max.min, reactor_max.max, backlog_max.min, backlog_max.max)

# convert requests array into sorted percent array
div = k * @req_per_connection/@workers.to_f
percents = requests.sort.map { |r| percent = 100.0 * (r - div)/div }

# std dev calc
n = requests.length.to_f
sq_sum = 0
sum = 0
requests.each do |i|
percents.each do |i|
sq_sum += i**2
sum += i
end
var = (sq_sum - sum**2/n)/n

div = k * @req_per_connection/@workers.to_f
percents = requests.sort.map do |r|
percent = 100.0 * (r - div)/div
format ' %5.1f', percent
end.join
percents_str = percents.map { |r| format ' %5.1f', r }.join

str << format(" %7.2f #{percents}\n", Math.sqrt(var))
str << format(" %7.2f #{percents_str}\n", Math.sqrt(var))
end
else
str << "\n#{@ka.ljust 23} ────── Max ─────\n"
Expand Down

0 comments on commit 4b194e3

Please sign in to comment.