Class: Rack::Bug::MemoryPanel

Inherits:
Panel
  • Object
show all
Defined in:
lib/rack/bug/panels/memory_panel.rb

Instance Attribute Summary

Attributes inherited from Panel

#request

Instance Method Summary collapse

Methods inherited from Panel

#call, #initialize, #panel_app, #render

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::Bug::Panel

Instance Method Details

#after(env, status, headers, body) ⇒ Object



11
12
13
14
# File 'lib/rack/bug/panels/memory_panel.rb', line 11

def after(env, status, headers, body)
  @total_memory = `ps -o rss= -p #{$$}`.to_i
  @memory_increase = @total_memory - @original_memory
end

#before(env) ⇒ Object



7
8
9
# File 'lib/rack/bug/panels/memory_panel.rb', line 7

def before(env)
  @original_memory = `ps -o rss= -p #{$$}`.to_i
end

#has_content?Boolean



20
21
22
# File 'lib/rack/bug/panels/memory_panel.rb', line 20

def has_content?
  false
end

#headingObject



16
17
18
# File 'lib/rack/bug/panels/memory_panel.rb', line 16

def heading
  "#{@memory_increase} KB Δ, #{@total_memory} KB total"
end