Sha256: 7d12cdecd4e5556a187c347e285efc790b4e276db8328fd5569ae0962821bb72

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module Concen
  class PerformancesController < Concen::ApplicationController
    def show
      @page_title = "Performance"
    end

    def responses
      @stats = {}
      @stats[:total_runtime] = Response.where(:created_at.gte => Time.now - 1.hour).asc(:created_at).map do |response|
        [(response.created_at.utc.to_f + response.created_at.utc_offset)*1000, response.total_runtime]
      end
      @stats[:view_runtime] = Response.where(:created_at.gte => Time.now - 1.hour).asc(:created_at).map do |response|
        if response.respond_to?("view_runtime")
          [(response.created_at.utc.to_f + response.created_at.utc_offset)*1000, response.view_runtime]
        end
      end
      @stats[:mongo_runtime] = Response.where(:created_at.gte => Time.now - 1.hour).asc(:created_at).map do |response|
        if response.respond_to?("mongo_runtime")
          [(response.created_at.utc.to_f + response.created_at.utc_offset)*1000, response.mongo_runtime]
        end
      end

      respond_to do |format|
        format.json { render :json => @stats }
      end
    end

    def runtimes
      @runtimes_stats = Response.aggregate_average_runtime(:type => params[:type])
      respond_to do |format|
        format.html { render :partial => "concen/performances/runtimes" }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concen-0.2.9 app/controllers/concen/performances_controller.rb
concen-0.2.8 app/controllers/concen/performances_controller.rb