Class: RailsPerformance::Reports::PercentileReport

Inherits:
BaseReport
  • Object
show all
Defined in:
lib/rails_performance/reports/percentile_report.rb

Instance Attribute Summary

Attributes inherited from BaseReport

#db, #group, #sort, #title

Instance Method Summary collapse

Methods inherited from BaseReport

#calculate_data, #collect, #initialize, #set_defaults, time_in_app_time_zone

Constructor Details

This class inherits a constructor from RailsPerformance::Reports::BaseReport

Instance Method Details

#dataObject



4
5
6
7
8
9
10
11
# File 'lib/rails_performance/reports/percentile_report.rb', line 4

def data
  durations = db.data.collect(&:duration).compact
  {
    p50: RailsPerformance::Utils.percentile(durations, 50),
    p95: RailsPerformance::Utils.percentile(durations, 95),
    p99: RailsPerformance::Utils.percentile(durations, 99)
  }
end