Class: Peek::Views::Memory
- Inherits:
-
View
- Object
- View
- Peek::Views::Memory
- Defined in:
- lib/peek/views/memory.rb
Constant Summary collapse
- MEM_TOTAL_LABEL =
'Total'
- MEM_OBJECTS_LABEL =
'Objects allocated'
- MEM_MALLOCS_LABEL =
'Allocator calls'
- MEM_BYTES_LABEL =
'Large allocations'
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Memory
constructor
A new instance of Memory.
- #results ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Memory
Returns a new instance of Memory.
11 12 13 14 15 |
# File 'lib/peek/views/memory.rb', line 11 def initialize( = {}) super @thread_memory = {} end |
Instance Method Details
#results ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/peek/views/memory.rb', line 17 def results return thread_memory if thread_memory.empty? { calls: byte_string(thread_memory[:mem_total_bytes]), summary: { MEM_OBJECTS_LABEL => number_string(thread_memory[:mem_objects]), MEM_MALLOCS_LABEL => number_string(thread_memory[:mem_mallocs]), MEM_BYTES_LABEL => byte_string(thread_memory[:mem_bytes]) }, details: [ { item_header: MEM_TOTAL_LABEL, item_content: "Total memory use of this request. This includes both occupancy of existing heap slots " \ "as well as newly allocated memory due to large objects. Not adjusted for freed memory. " \ "Lower is better." }, { item_header: MEM_OBJECTS_LABEL, item_content: "Total number of objects allocated by the Ruby VM during this request. " \ "Not adjusted for objects that were freed again. Lower is better." }, { item_header: MEM_MALLOCS_LABEL, item_content: "Total number of times Ruby had to call `malloc`, the C memory allocator. " \ "This is necessary for objects that are too large to fit into a 40 Byte slot in Ruby's managed heap. " \ "Lower is better." }, { item_header: MEM_BYTES_LABEL, item_content: "Memory allocated for objects that did not fit into a heap slot. " \ "Not adjusted for memory that was freed again. Lower is better." } ] } end |