Sha256: d2f43fdf7d6188594494a42c9e6e022ed57adae5ec3184e83b104378a3abda4e

Contents?: true

Size: 875 Bytes

Versions: 38

Compression:

Stored size: 875 Bytes

Contents

module RailsPerformance
  module Reports
    class ThroughputReport < BaseReport

      def set_defaults
        @group ||= :datetime
      end

      def data
        all     = {}
        stop    = Time.at(60 * (Time.now.to_i / 60))
        current = stop - RailsPerformance.duration
        @data   = []
        offset  = Time.current.utc_offset

        # puts "current: #{current}"
        # puts "stop: #{stop}"

        # read current values
        db.group_by(group).each do |(k, v)|
          all[k] = v.count
        end

        # add blank columns
        while current <= stop
          views = all[current.strftime(RailsPerformance::FORMAT)] || 0
          @data << [(current.to_i + offset) * 1000, views.to_i]
          current += 1.minute
        end

        # sort by time
        @data.sort!
      end

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
rails_performance-1.1.0 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.5.3 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.5.2 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.5.1 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.5 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.4 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.3 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.2 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.1 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0.beta5 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0.beta4 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0.beta3 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0.beta2 lib/rails_performance/reports/throughput_report.rb
rails_performance-1.0.0.beta1 lib/rails_performance/reports/throughput_report.rb
rails_performance-0.9.9 lib/rails_performance/reports/throughput_report.rb
rails_performance-0.9.8 lib/rails_performance/reports/throughput_report.rb
rails_performance-0.9.7 lib/rails_performance/reports/throughput_report.rb
rails_performance-0.9.6 lib/rails_performance/reports/throughput_report.rb
rails_performance-0.9.5 lib/rails_performance/reports/throughput_report.rb