Class: Rack::Insight::MemoryPanel
- Defined in:
- lib/rack/insight/panels/memory_panel.rb
Instance Attribute Summary
Attributes inherited from Panel
Instance Method Summary collapse
- #after(env, status, headers, body) ⇒ Object
- #before(env) ⇒ Object
- #has_content? ⇒ Boolean
- #heading_for_request(number) ⇒ Object
Methods inherited from Panel
#after_detect, #bool_prop, #call, #camelized_name, #content, #content_for_request, current_panel_file, excluded, file_index, from_file, #handle_error_for, #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
#after(env, status, headers, body) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rack/insight/panels/memory_panel.rb', line 9 def after(env, status, headers, body) total_memory = `ps -o rss= -p #{$$}`.to_i store(env, {:total_memory => total_memory, :memory_increase => total_memory - @original_memory, :original_memory => @original_memory}) end |
#before(env) ⇒ Object
5 6 7 |
# File 'lib/rack/insight/panels/memory_panel.rb', line 5 def before(env) @original_memory = `ps -o rss= -p #{$$}`.to_i end |
#has_content? ⇒ Boolean
22 23 24 |
# File 'lib/rack/insight/panels/memory_panel.rb', line 22 def has_content? false end |
#heading_for_request(number) ⇒ Object
16 17 18 19 20 |
# File 'lib/rack/insight/panels/memory_panel.rb', line 16 def heading_for_request(number) record = retrieve(number).first "#{record[:memory_increase]} KB Δ, #{record[:total_memory]} KB total" end |