Class: Concen::PerformancesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/concen/performances_controller.rb

Instance Method Summary collapse

Instance Method Details

#responsesObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/concen/performances_controller.rb', line 7

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

#runtimesObject



28
29
30
31
32
33
# File 'app/controllers/concen/performances_controller.rb', line 28

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

#showObject



3
4
5
# File 'app/controllers/concen/performances_controller.rb', line 3

def show
  @page_title = "Performance"
end