Sha256: cdbaa547abd78ea72f2ef4154f5b6b2ba4e7c4ecc09f464dc44ce1eb78d7c36d

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

# Draws a graph containing the average amound of requests per hour per day
if $summarizer.request_time_graph?

  max_request_graph = $summarizer.request_time_graph.max / $summarizer.duration
  deviation         = max_request_graph / 20
  deviation         = 1 if deviation == 0
  color_cutoff      = 15
  
  puts
  puts "Requests graph - average per day per hour"
  puts green("========================================================================")
  
  (0..23).each do |a|
    requests      = $summarizer.request_time_graph[a] / $summarizer.duration
    display_chars = requests / deviation
    
    if display_chars >= color_cutoff
      display_chars_string = green(' ΢' * color_cutoff) + red(' ΢' * (display_chars - color_cutoff))
    else
      display_chars_string = green(' ΢' * display_chars)
    end
    
    puts "#{a.to_s.rjust(10)}:00 - #{('[' + requests.to_s + ' req.]').ljust(15)} : #{display_chars_string}"
  end
else
  puts
  puts "Hourly spread not available"
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
lackac-request-log-analyzer-0.1.3 output/hourly_spread.rb
wvanbergen-request-log-analyzer-0.2.2 output/hourly_spread.rb