Class: Rack::Insight::TimerPanel
- Defined in:
- lib/rack/insight/panels/timer_panel.rb
Instance Attribute Summary
Attributes inherited from Panel
Instance Method Summary collapse
Methods inherited from Panel
#after, #after_detect, #before, #bool_prop, #camelized_name, #content, current_panel_file, excluded, file_index, from_file, #handle_error_for, #has_content?, #has_custom_probes?, has_table, #has_table?, #heading, inherited, #initialize, #inspect, #is_magic?, #is_probing?, #name, #panel_app, panel_exclusion, panel_mappings, #render, set_sub_class_template_root, #underscored_name
Methods included from Database::EigenClient
Methods included from Instrumentation::EigenClient
Methods included from Logging
Methods included from Instrumentation::Client
#after_detect, #before_detect, #probe, #request_finish, #request_start
Methods included from Database::RequestDataClient
#count, #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
This class inherits a constructor from Rack::Insight::Panel
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rack/insight/panels/timer_panel.rb', line 6 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 |
#content_for_request(number) ⇒ Object
28 29 30 |
# File 'lib/rack/insight/panels/timer_panel.rb', line 28 def content_for_request(number) render_template "panels/timer", :measurements => retrieve(number).first end |
#heading_for_request(number) ⇒ Object
22 23 24 25 26 |
# File 'lib/rack/insight/panels/timer_panel.rb', line 22 def heading_for_request(number) measurements = retrieve(number).first measurements.last.last end |