wvanbergen-request-log-analyzer 0.3.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,81 +0,0 @@
1
- require 'date'
2
- module RailsAnalyzer
3
-
4
- # Functions to summarize an array of requets.
5
- # Can calculate request counts, duratations, mean times etc. of all the requests given.
6
- class Summarizer < Base::Summarizer
7
-
8
- # Initializer. Sets global variables
9
- # Options
10
- # * <tt>:calculate_database</tt> Calculate the database times if they are not explicitly logged.
11
- def initialize_hook(options = {})
12
- @calculate_database = options[:calculate_database]
13
- end
14
-
15
- # Parse a request string into a hash containing all keys found in the string.
16
- # Yields the hash found to the block operator.
17
- # <tt>request</tt> The request string to parse.
18
- # <tt>&block</tt> Block operator
19
- def group(request, &block)
20
- request[:duration] ||= 0
21
-
22
- case request[:type]
23
- when :started
24
- if request[:timestamp]
25
- if @first_request_at.nil? || hamburger_compare_string_dates(request[:timestamp], @first_request_at) == -1
26
- @first_request_at = request[:timestamp]
27
- end
28
-
29
- if @last_request_at.nil? || hamburger_compare_string_dates(request[:timestamp], @last_request_at) == 1
30
- @last_request_at = request[:timestamp]
31
- end
32
-
33
- @request_time_graph[request[:timestamp][11..12].to_i] +=1
34
- end
35
-
36
- if request[:method]
37
- @methods[request[:method].to_sym] ||= 0
38
- @methods[request[:method].to_sym] += 1
39
- else
40
- @methods[:unknown] += 1
41
- end
42
-
43
- when :completed
44
- @request_count += 1
45
- hash = block_given? ? yield(request) : request.hash
46
-
47
- @actions[hash] ||= {:count => 0, :total_time => 0.0, :total_db_time => 0.0, :total_rendering_time => 0.0,
48
- :min_time => request[:duration], :max_time => request[:duration] }
49
-
50
- @actions[hash][:count] += 1
51
- @actions[hash][:total_time] += request[:duration]
52
- @actions[hash][:total_db_time] += request[:db] if request[:db]
53
- @actions[hash][:total_db_time] += request[:duration] - request[:rendering] if @calculate_database && request[:duration] && request[:rendering]
54
-
55
- @actions[hash][:total_rendering_time] += request[:rendering] if request[:rendering]
56
-
57
- @actions[hash][:min_time] = [@actions[hash][:min_time], request[:duration]].min
58
- @actions[hash][:max_time] = [@actions[hash][:min_time], request[:duration]].max
59
- @actions[hash][:mean_time] = @actions[hash][:total_time] / @actions[hash][:count].to_f
60
-
61
- @actions[hash][:mean_db_time] = @actions[hash][:total_db_time] / @actions[hash][:count].to_f
62
- @actions[hash][:mean_rendering_time] = @actions[hash][:total_rendering_time] / @actions[hash][:count].to_f
63
-
64
- if request[:duration] > @blocker_duration
65
- @blockers[hash] ||= { :count => 0, :total_time => 0.0 }
66
- @blockers[hash][:count] += 1
67
- @blockers[hash][:total_time] += request[:duration]
68
- end
69
-
70
- when :failed
71
- hash = request[:error]
72
- @errors[hash] ||= {:count => 0, :exception_strings => {}}
73
- @errors[hash][:count] +=1
74
-
75
- @errors[hash][:exception_strings][request[:exception_string]] ||= 0
76
- @errors[hash][:exception_strings][request[:exception_string]] += 1
77
- end
78
- end
79
-
80
- end
81
- end
@@ -1,91 +0,0 @@
1
- # Can calculate request counts, duratations, mean times etc. of all the requests given.
2
- class VirtualMongrel
3
- STATUS = [:started, :completed]
4
-
5
- attr_reader :status
6
- attr_reader :start_line
7
- attr_reader :start_time
8
- attr_reader :die_line
9
- attr_reader :die_time
10
- attr_reader :calculate_database
11
- attr_reader :running_mongrels
12
-
13
- attr_reader :data_hash
14
-
15
- def initialize(options = {})
16
- @status = :started
17
-
18
- @start_line = options[:start_line] || 0
19
- @die_line = options[:die_line] || @start_line + 10
20
-
21
- @start_time = options[:start_time] || 0
22
- @die_time = options[:die_time] || @start_time + 10
23
-
24
- @data_hash = {}
25
- @calculate_database = false
26
- @running_mongrels = options[:running_mongrels] || 1
27
- end
28
-
29
- def update_running_mongrels(number)
30
- @running_mongrels = number if number > @running_mongrels
31
- end
32
-
33
-
34
- def group(request, &block)
35
- case request[:type]
36
- when :started
37
- data_hash.store(:timestamp, request[:timestamp])
38
- data_hash.store(:method, request[:method])
39
- @status = :started
40
-
41
- when :completed
42
- data_hash.store(:url, request[:url])
43
- data_hash.store(:hashed_request, request_hasher(request))
44
- data_hash.store(:rendering, request[:rendering])
45
- data_hash.store(:duration, request[:duration])
46
- data_hash.store(:db_time, request[:db])
47
-
48
- if @calculate_database && request[:duration] && request[:rendering]
49
- data_hash.store(:db_time, request[:duration] - request[:request])
50
- end
51
-
52
- @status = :completed
53
-
54
- when :failed
55
- data_hash.store(:error, request[:error])
56
- data_hash.store(:exception_string, request[:exception_string])
57
- @status = :completed
58
-
59
- end
60
- end
61
-
62
- # Substitutes variable elements in a url (like the id field) with a fixed string (like ":id")
63
- # This is used to aggregate simular requests.
64
- # <tt>request</tt> The request to evaluate.
65
- # Returns uniformed url string.
66
- # Raises on mailformed request.
67
- def request_hasher(request)
68
- if request[:url]
69
- url = request[:url].downcase.split(/^http[s]?:\/\/[A-z0-9\.-]+/).last.split('?').first # only the relevant URL part
70
- url << '/' if url[-1] != '/'[0] && url.length > 1 # pad a trailing slash for consistency
71
-
72
- url.gsub!(/\/\d+-\d+-\d+(\/|$)/, '/:date') # Combine all (year-month-day) queries
73
- url.gsub!(/\/\d+-\d+(\/|$)/, '/:month') # Combine all date (year-month) queries
74
- url.gsub!(/\/\d+[\w-]*/, '/:id') # replace identifiers in URLs
75
-
76
- return url
77
- elsif request[:controller] && request[:action]
78
- return "#{request[:controller]}##{request[:action]}"
79
- else
80
- raise 'Cannot hash this request! ' + request.inspect
81
- end
82
- end
83
-
84
- # Store this mongrel in the database
85
- def save
86
- puts 'Saving mongrel!'
87
- puts "Number of other running mongrels (certainty) #{running_mongrels}"
88
- puts data_hash.to_s
89
- end
90
-
91
- end
@@ -1,103 +0,0 @@
1
- =begin
2
- index:Ej
3
-
4
- = Ruby/ProgressBar: A Text Progress Bar Library for Ruby
5
-
6
- Last Modified: 2005-05-22 00:28:04
7
-
8
- --
9
-
10
- Ruby/ProgressBar is a text progress bar library for Ruby.
11
- It can indicate progress with percentage, a progress bar,
12
- and estimated remaining time.
13
-
14
- The latest version of Ruby/ProgressBar is available at
15
- ((<URL:http://namazu.org/~satoru/ruby-progressbar/>))
16
- .
17
-
18
- == Examples
19
-
20
- % irb --simple-prompt -r progressbar
21
- >> pbar = ProgressBar.new("test", 100)
22
- => (ProgressBar: 0/100)
23
- >> 100.times {sleep(0.1); pbar.inc}; pbar.finish
24
- test: 100% |oooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
25
- => nil
26
-
27
- >> pbar = ProgressBar.new("test", 100)
28
- => (ProgressBar: 0/100)
29
- >> (1..100).each{|x| sleep(0.1); pbar.set(x)}; pbar.finish
30
- test: 67% |oooooooooooooooooooooooooo | ETA: 00:00:03
31
-
32
- == API
33
-
34
- --- ProgressBar#new (title, total, out = STDERR)
35
- Display the initial progress bar and return a
36
- ProgressBar object. ((|title|)) specifies the title,
37
- and ((|total|)) specifies the total cost of processing.
38
- Optional parameter ((|out|)) specifies the output IO.
39
-
40
- The display of the progress bar is updated when one or
41
- more percent is proceeded or one or more seconds are
42
- elapsed from the previous display.
43
-
44
- --- ProgressBar#inc (step = 1)
45
- Increase the internal counter by ((|step|)) and update
46
- the display of the progress bar. Display the estimated
47
- remaining time on the right side of the bar. The counter
48
- does not go beyond the ((|total|)).
49
-
50
- --- ProgressBar#set (count)
51
- Set the internal counter to ((|count|)) and update the
52
- display of the progress bar. Display the estimated
53
- remaining time on the right side of the bar. Raise if
54
- ((|count|)) is a negative number or a number more than
55
- the ((|total|)).
56
-
57
- --- ProgressBar#finish
58
- Stop the progress bar and update the display of progress
59
- bar. Display the elapsed time on the right side of the bar.
60
- The progress bar always stops at 100 % by the method.
61
-
62
- --- ProgressBar#halt
63
- Stop the progress bar and update the display of progress
64
- bar. Display the elapsed time on the right side of the bar.
65
- The progress bar stops at the current percentage by the method.
66
-
67
- --- ProgressBar#format=
68
- Set the format for displaying a progress bar.
69
- Default: "%-14s %3d%% %s %s".
70
-
71
- --- ProgressBar#format_arguments=
72
- Set the methods for displaying a progress bar.
73
- Default: [:title, :percentage, :bar, :stat].
74
-
75
- --- ProgressBar#file_transfer_mode
76
- Use :stat_for_file_transfer instead of :stat to display
77
- transfered bytes and transfer rate.
78
-
79
-
80
- ReverseProgressBar class is also available. The
81
- functionality is identical to ProgressBar but the direction
82
- of the progress bar is just opposite.
83
-
84
- == Limitations
85
-
86
- Since the progress is calculated by the proportion to the
87
- total cost of processing, Ruby/ProgressBar cannot be used if
88
- the total cost of processing is unknown in advance.
89
- Moreover, the estimation of remaining time cannot be
90
- accurately performed if the progress does not flow uniformly.
91
-
92
- == Download
93
-
94
- Ruby/ProgressBar is a free software with ABSOLUTELY NO WARRANTY
95
- under the terms of Ruby's license.
96
-
97
- * ((<URL:http://namazu.org/~satoru/ruby-progressbar/ruby-progressbar-0.9.tar.gz>))
98
- * ((<URL:http://cvs.namazu.org/ruby-progressbar/>))
99
-
100
- --
101
-
102
- - ((<Satoru Takabayashi|URL:http://namazu.org/~satoru/>)) -
103
- =end
@@ -1,100 +0,0 @@
1
- =begin
2
- index:eJ
3
-
4
- = Ruby/ProgressBar: �ץ����쥹�С���ƥ����Ȥ�ɽ������ Ruby�ѤΥ饤�֥��
5
-
6
- �ǽ�������: 2005-05-22 00:28:53
7
-
8
-
9
- --
10
-
11
- Ruby/ProgressBar �ϥץ����쥹�С���ƥ����Ȥ�ɽ������ Ruby��
12
- �Υ饤�֥��Ǥ��������ο�Ľ������ѡ�����ȡ��ץ����쥹�С���
13
- ����ӿ���Ĥ���֤Ȥ���ɽ�����ޤ���
14
-
15
- �ǿ��Ǥ�
16
- ((<URL:http://namazu.org/~satoru/ruby-progressbar/>))
17
- ���������ǽ�Ǥ�
18
-
19
- == ������
20
-
21
- % irb --simple-prompt -r progressbar
22
- >> pbar = ProgressBar.new("test", 100)
23
- => (ProgressBar: 0/100)
24
- >> 100.times {sleep(0.1); pbar.inc}; pbar.finish
25
- test: 100% |oooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
26
- => nil
27
-
28
- >> pbar = ProgressBar.new("test", 100)
29
- => (ProgressBar: 0/100)
30
- >> (1..100).each{|x| sleep(0.1); pbar.set(x)}; pbar.finish
31
- test: 67% |oooooooooooooooooooooooooo | ETA: 00:00:03
32
-
33
- == API
34
-
35
- --- ProgressBar#new (title, total, out = STDERR)
36
- �ץ����쥹�С��ν�����֤�ɽ������������ ProgressBar����
37
- �������Ȥ��֤���((|title|)) �Ǹ��Ф���((|total|)) �ǽ�
38
- �������פ�((|out|)) �ǽ������ IO �����ꤹ�롣
39
-
40
- �ץ����쥹�С���ɽ���ϡ������ɽ�������Ľ�� 1%�ʾ夢��
41
- ���Ȥ������뤤�� 1�ðʾ�вᤷ�����˹�������ޤ���
42
-
43
- --- ProgressBar#inc (step = 1)
44
- �����Υ����󥿤� ((|step|)) �������ʤ�ơ��ץ����쥹�С�
45
- ��ɽ���򹹿����롣�С��α�¦�ˤϿ���Ĥ���֤�ɽ�����롣
46
- �����󥿤� ((|total|)) ��ۤ��ƿʤळ�ȤϤʤ���
47
-
48
- --- ProgressBar#set (count)
49
- �����󥿤��ͤ� ((|count|)) �����ꤷ���ץ����쥹�С���
50
- ɽ���򹹿����롣�С��α�¦�ˤϿ���Ĥ���֤�ɽ�����롣
51
- ((|count|)) �˥ޥ��ʥ����ͤ��뤤�� ((|total|)) ����礭
52
- ���ͤ��Ϥ����㳰��ȯ�����롣
53
-
54
- --- ProgressBar#finish
55
- �ץ����쥹�С�����ߤ����ץ����쥹�С���ɽ���򹹿����롣
56
- �ץ����쥹�С��α�¦�ˤϷв���֤�ɽ�����롣
57
- ���ΤȤ����ץ����쥹�С��� 100% �ǽ�λ���롣
58
-
59
- --- ProgressBar#halt
60
- �ץ����쥹�С�����ߤ����ץ����쥹�С���ɽ���򹹿����롣
61
- �ץ����쥹�С��α�¦�ˤϷв���֤�ɽ�����롣
62
- ���ΤȤ����ץ����쥹�С��Ϥ��λ����Υѡ�����ơ����ǽ�λ���롣
63
-
64
- --- ProgressBar#format=
65
- �ץ����쥹�С�ɽ���Υե����ޥåȤ����ꤹ�롣
66
- ̤�ѹ����� "%-14s %3d%% %s %s"
67
-
68
- --- ProgressBar#format_arguments=
69
- �ץ����쥹�С�ɽ���˻Ȥ��ؿ������ꤹ�롣
70
- ̤�ѹ����� [:title, :percentage, :bar, :stat]
71
- �ե�����ž�����ˤ� :stat ���Ѥ��� :stat_for_file_transfer
72
- ��Ȥ���ž���Х��ȿ���ž��®�٤�ɽ���Ǥ��롣
73
-
74
- --- ProgressBar#file_transfer_mode
75
- �ץ����쥹�С�ɽ���� :stat ���Ѥ��� :stat_for_file_transfer
76
- ��Ȥ���ž���Х��ȿ���ž��®�٤�ɽ�����롣
77
-
78
-
79
- ReverseProgressBar �Ȥ������饹���󶡤���ޤ�����ǽ��
80
- ProgressBar �Ȥޤä���Ʊ���Ǥ������ץ����쥹�С��οʹ�������
81
- �դˤʤäƤ��ޤ���
82
-
83
- == ���»���
84
-
85
- ��Ľ��������������פ��Ф�����Ȥ��Ʒ׻����뤿�ᡢ��������
86
- �פ������ˤ狼��ʤ������ǤϻȤ��ޤ��󡣤ޤ�����Ľ��ή�줬��
87
- ��Ǥʤ��Ȥ��ˤϻĤ���֤ο�����������Ԥ��ޤ���
88
-
89
- == �����������
90
-
91
- Ruby �Υ饤���󥹤˽��ä��ե꡼���եȥ������Ȥ��Ƹ������ޤ���
92
- ������̵�ݾڤǤ���
93
-
94
- * ((<URL:http://namazu.org/~satoru/ruby-progressbar/ruby-progressbar-0.9.tar.gz>))
95
- * ((<URL:http://cvs.namazu.org/ruby-progressbar/>))
96
-
97
- --
98
-
99
- - ((<Satoru Takabayashi|URL:http://namazu.org/~satoru/>)) -
100
- =end
@@ -1,236 +0,0 @@
1
- #
2
- # Ruby/ProgressBar - a text progress bar library
3
- #
4
- # Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
5
- # All rights reserved.
6
- # This is free software with ABSOLUTELY NO WARRANTY.
7
- #
8
- # You can redistribute it and/or modify it under the terms
9
- # of Ruby's license.
10
- #
11
-
12
- class ProgressBar
13
- VERSION = "0.9"
14
-
15
- def initialize (title, total, out = STDERR)
16
- @title = title
17
- @total = total
18
- @out = out
19
- @terminal_width = 80
20
- @bar_mark = '='
21
- @current = 0
22
- @previous = 0
23
- @finished_p = false
24
- @start_time = Time.now
25
- @previous_time = @start_time
26
- @title_width = 24
27
- @format = "%-#{@title_width}s %3d%% %s %s"
28
- @format_arguments = [:title, :percentage, :bar, :stat]
29
- clear
30
- show
31
- end
32
- attr_reader :title
33
- attr_reader :current
34
- attr_reader :total
35
- attr_accessor :start_time
36
-
37
- private
38
- def fmt_bar
39
- bar_width = do_percentage * @terminal_width / 100
40
- sprintf("[%s%s]",
41
- @bar_mark * bar_width,
42
- " " * (@terminal_width - bar_width))
43
- end
44
-
45
- def fmt_percentage
46
- do_percentage
47
- end
48
-
49
- def fmt_stat
50
- if @finished_p then elapsed else eta end
51
- end
52
-
53
- def fmt_stat_for_file_transfer
54
- if @finished_p then
55
- sprintf("%s %s %s", bytes, transfer_rate, elapsed)
56
- else
57
- sprintf("%s %s %s", bytes, transfer_rate, eta)
58
- end
59
- end
60
-
61
- def fmt_title
62
- @title[0,(@title_width - 1)] + ":"
63
- end
64
-
65
- def convert_bytes (bytes)
66
- if bytes < 1024
67
- sprintf("%6dB", bytes)
68
- elsif bytes < 1024 * 1000 # 1000kb
69
- sprintf("%5.1fKB", bytes.to_f / 1024)
70
- elsif bytes < 1024 * 1024 * 1000 # 1000mb
71
- sprintf("%5.1fMB", bytes.to_f / 1024 / 1024)
72
- else
73
- sprintf("%5.1fGB", bytes.to_f / 1024 / 1024 / 1024)
74
- end
75
- end
76
-
77
- def transfer_rate
78
- bytes_per_second = @current.to_f / (Time.now - @start_time)
79
- sprintf("%s/s", convert_bytes(bytes_per_second))
80
- end
81
-
82
- def bytes
83
- convert_bytes(@current)
84
- end
85
-
86
- def format_time (t)
87
- t = t.to_i
88
- sec = t % 60
89
- min = (t / 60) % 60
90
- hour = t / 3600
91
- sprintf("%02d:%02d:%02d", hour, min, sec);
92
- end
93
-
94
- # ETA stands for Estimated Time of Arrival.
95
- def eta
96
- if @current == 0
97
- white("ETA: --:--:--")
98
- else
99
- elapsed = Time.now - @start_time
100
- eta = elapsed * @total / @current - elapsed;
101
- sprintf(white("ETA: %s"), format_time(eta))
102
- end
103
- end
104
-
105
- def elapsed
106
- elapsed = Time.now - @start_time
107
- sprintf("Time: %s", format_time(elapsed))
108
- end
109
-
110
- def eol
111
- if @finished_p then "\n" else "\r" end
112
- end
113
-
114
- def do_percentage
115
- if @total.zero?
116
- 100
117
- else
118
- @current * 100 / @total
119
- end
120
- end
121
-
122
- def get_width
123
- # FIXME: I don't know how portable it is.
124
- default_width = 80
125
- begin
126
- tiocgwinsz = 0x5413
127
- data = [0, 0, 0, 0].pack("SSSS")
128
- if @out.ioctl(tiocgwinsz, data) >= 0 then
129
- rows, cols, xpixels, ypixels = data.unpack("SSSS")
130
- if cols >= 0 then cols else default_width end
131
- else
132
- default_width
133
- end
134
- rescue Exception
135
- default_width
136
- end
137
- end
138
-
139
- def show
140
- arguments = @format_arguments.map {|method|
141
- method = sprintf("fmt_%s", method)
142
- send(method)
143
- }
144
- line = sprintf(@format, *arguments)
145
-
146
- width = get_width
147
- if line.length == width - 1
148
- @out.print(line + eol)
149
- @out.flush
150
- elsif line.length >= width
151
- @terminal_width = [@terminal_width - (line.length - width + 1), 0].max
152
- if @terminal_width == 0 then @out.print(line + eol) else show end
153
- else # line.length < width - 1
154
- @terminal_width += width - line.length + 1
155
- show
156
- end
157
- @previous_time = Time.now
158
- end
159
-
160
- def show_if_needed
161
- if @total.zero?
162
- cur_percentage = 100
163
- prev_percentage = 0
164
- else
165
- cur_percentage = (@current * 100 / @total).to_i
166
- prev_percentage = (@previous * 100 / @total).to_i
167
- end
168
-
169
- # Use "!=" instead of ">" to support negative changes
170
- if cur_percentage != prev_percentage ||
171
- Time.now - @previous_time >= 1 || @finished_p
172
- show
173
- end
174
- end
175
-
176
- public
177
- def clear
178
- @out.print "\r"
179
- @out.print(" " * (get_width - 1))
180
- @out.print "\r"
181
- end
182
-
183
- def finish
184
- @current = @total
185
- @finished_p = true
186
- show
187
- end
188
-
189
- def finished?
190
- @finished_p
191
- end
192
-
193
- def file_transfer_mode
194
- @format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer]
195
- end
196
-
197
- def format= (format)
198
- @format = format
199
- end
200
-
201
- def format_arguments= (arguments)
202
- @format_arguments = arguments
203
- end
204
-
205
- def halt
206
- @finished_p = true
207
- show
208
- end
209
-
210
- def inc (step = 1)
211
- @current += step
212
- @current = @total if @current > @total
213
- show_if_needed
214
- @previous = @current
215
- end
216
-
217
- def set (count)
218
- if count < 0 || count > @total
219
- raise "invalid count: #{count} (total: #{@total})"
220
- end
221
- @current = count
222
- show_if_needed
223
- @previous = @current
224
- end
225
-
226
- def inspect
227
- "#<ProgressBar:#{@current}/#{@total}>"
228
- end
229
- end
230
-
231
- class ReversedProgressBar < ProgressBar
232
- def do_percentage
233
- 100 - super
234
- end
235
- end
236
-
data/output/blockers.rb DELETED
@@ -1,9 +0,0 @@
1
- # Print requests that took more than a second to complete, sorted by their frequency.
2
- puts
3
- puts "Mongrel process blockers (> #{@summarizer.blocker_duration} seconds)"
4
- puts green("========================================================================")
5
-
6
- @summarizer.sort_blockers_by(:count).reverse[0, @amount].each do |a|
7
- puts "%-50s: %10.03fs [#{green("%d requests")}]" % [a[0], a[1][:total_time], a[1][:count]]
8
- end
9
-
data/output/errors.rb DELETED
@@ -1,8 +0,0 @@
1
- # Print errors that occured often
2
- puts
3
- puts "Errors"
4
- puts green("========================================================================")
5
- @summarizer.sort_errors_by(:count).reverse[0, @amount].each do |a|
6
- puts "%s: [#{green("%d requests")}]" % [a[0] + 'Error', a[1][:count]]
7
- puts blue(' -> ' + (a[1][:exception_strings].invert[ a[1][:exception_strings].values.max ])[0..79])
8
- end
@@ -1,28 +0,0 @@
1
- # Draws a graph containing the average amound of requests per hour per day
2
- if @summarizer.request_time_graph?
3
-
4
- max_request_graph = @summarizer.request_time_graph.max / @summarizer.duration
5
- deviation = max_request_graph / 20
6
- deviation = 1 if deviation == 0
7
- color_cutoff = 15
8
-
9
- puts
10
- puts "Requests graph - average per day per hour"
11
- puts green("========================================================================")
12
-
13
- (0..23).each do |a|
14
- requests = @summarizer.request_time_graph[a] / @summarizer.duration
15
- display_chars = requests / deviation
16
-
17
- if display_chars >= color_cutoff
18
- display_chars_string = green(' ΢' * color_cutoff) + red(' ΢' * (display_chars - color_cutoff))
19
- else
20
- display_chars_string = green(' ΢' * display_chars)
21
- end
22
-
23
- puts "#{a.to_s.rjust(10)}:00 - #{('[' + requests.to_s + ' req.]').ljust(15)} : #{display_chars_string}"
24
- end
25
- else
26
- puts
27
- puts "Hourly spread not available"
28
- end
@@ -1,6 +0,0 @@
1
- # Prints a table sorted by the highest database times.
2
- puts
3
- puts "Top #{amount} worst DB offenders - mean time"
4
- puts green("========================================================================")
5
- print_table(@summarizer, :mean_db_time, @amount)
6
-
@@ -1,6 +0,0 @@
1
- # Prints a table showing the slowest renderes
2
- puts
3
- puts "Top #{@amount} slow renderers - mean time"
4
- puts green("========================================================================")
5
- print_table(@summarizer, :mean_rendering_time, @amount)
6
-
data/output/mean_time.rb DELETED
@@ -1,6 +0,0 @@
1
- # Prints table sorted by the duration of the requests
2
- puts
3
- puts "Top #{@amount} actions by time - per request mean"
4
- puts green("========================================================================")
5
-
6
- print_table(@summarizer, :mean_time, @amount)
@@ -1,5 +0,0 @@
1
- # Prints a table sorted by the most frequently requested actions
2
- puts
3
- puts "Top #{amount} most requested actions"
4
- puts green("========================================================================")
5
- print_table(@summarizer, :count, @amount)