Sha256: 29382e92c3b2431b72490cf60a467cc7d427f1f921927237c81cc0786cd4ec5d

Contents?: true

Size: 614 Bytes

Versions: 20

Compression:

Stored size: 614 Bytes

Contents

module Rack::Insight

  class MemoryPanel < Panel

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

    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

    def heading_for_request(number)
      record = retrieve(number).first

      "#{record[:memory_increase]} KB &#916;, #{record[:total_memory]} KB total"
    end

    def has_content?
      false
    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rack-insight-0.6.4 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.6.3 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.6.2 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.30 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.29 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.28 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.27 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.26 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.25 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.24 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.23 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.22 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.21 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.20 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.19 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.18 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.17 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.16 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.15 lib/rack/insight/panels/memory_panel.rb
rack-insight-0.5.14 lib/rack/insight/panels/memory_panel.rb