Class: RailsPerformance::Reports::ThroughputReport
- Inherits:
-
BaseReport
- Object
- BaseReport
- RailsPerformance::Reports::ThroughputReport
show all
- Defined in:
- lib/rails_performance/reports/throughput_report.rb
Instance Attribute Summary
Attributes inherited from BaseReport
#db, #group, #sort, #title
Instance Method Summary
collapse
Methods inherited from BaseReport
#collect, #initialize
Instance Method Details
#data ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/rails_performance/reports/throughput_report.rb', line 9
def data
all = {}
stop = Time.at(60 * (Time.now.to_i / 60))
current = stop - RailsPerformance.duration
@data = []
offset = Time.current.utc_offset
db.group_by(group).each do |(k, v)|
all[k] = v.count
end
while current <= stop
views = all[current.strftime(RailsPerformance::FORMAT)] || 0
@data << [(current.to_i + offset) * 1000, views.to_i]
current += 1.minute
end
@data.sort!
end
|
#set_defaults ⇒ Object
5
6
7
|
# File 'lib/rails_performance/reports/throughput_report.rb', line 5
def set_defaults
@group ||= :datetime
end
|