Class: Insight::TimerPanel
- Inherits:
-
Panel
- Object
- Panel
- Insight::TimerPanel
- Defined in:
- lib/insight/panels/timer_panel.rb
Instance Attribute Summary
Attributes inherited from Panel
Instance Method Summary (collapse)
- - (Object) call(env)
- - (Object) content_for_request(number)
- - (Object) heading_for_request(number)
-
- (TimerPanel) initialize(app)
constructor
A new instance of TimerPanel.
- - (Object) name
Methods inherited from Panel
#after, #before, current_panel_file, excluded, file_index, from_file, #has_content?, inherited, #panel_app, panel_exclusion, panel_mappings, #render
Methods included from Instrumentation::Client
#after_detect, #before_detect, #probe, #request_finish, #request_start
Methods included from Logging
Methods included from Database::RequestDataClient
#key_sql_template, #retrieve, #store, #table_length, #table_setup
Methods included from Render
#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params
Constructor Details
- (TimerPanel) initialize(app)
A new instance of TimerPanel
5 6 7 8 |
# File 'lib/insight/panels/timer_panel.rb', line 5 def initialize(app) super table_setup("timer") end |
Instance Method Details
- (Object) call(env)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/insight/panels/timer_panel.rb', line 14 def call(env) status, headers, body = nil @times = Benchmark.measure do status, headers, body = @app.call(env) end store(env, [ ["User CPU time", "%.2fms" % (@times.utime * 1_000)], ["System CPU time", "%.2fms" % (@times.stime * 1_000)], ["Total CPU time", "%.2fms" % (@times.total * 1_000)], ["Elapsed time", "%.2fms" % (@times.real * 1_000)] ]) return [status, headers, body] end |
- (Object) content_for_request(number)
36 37 38 |
# File 'lib/insight/panels/timer_panel.rb', line 36 def content_for_request(number) render_template "panels/timer", :measurements => retrieve(number).first end |
- (Object) heading_for_request(number)
30 31 32 33 34 |
# File 'lib/insight/panels/timer_panel.rb', line 30 def heading_for_request(number) measurements = retreive(number).first measurements.last.last end |
- (Object) name
10 11 12 |
# File 'lib/insight/panels/timer_panel.rb', line 10 def name "timer" end |