class Memory
Represents memory usage for a process, sizes are in kilobytes.
Nested
Definitions
def supported?
Whether memory capture is supported on this platform.
Signature
-
returns
Boolean True if vmmap is available.
Implementation
def supported?
return true
end
def supported?
Whether memory capture is supported on this platform.
Signature
-
returns
Boolean True if /proc/[pid]/smaps or smaps_rollup is readable.
Implementation
def supported?
return true
end
def self.supported?
Whether the memory usage can be captured on this system.
Implementation
def self.supported?
false
end
def total_size
Get total system memory size.
Signature
-
returns
Integer Total memory in kilobytes.
Implementation
def total_size
return Memory::Darwin.total_size
end
def total_size
Get total system memory size.
Signature
-
returns
Integer Total memory in kilobytes.
Implementation
def total_size
return Memory::Linux.total_size
end
def total_size
The total size of the process in memory.
Implementation
def total_size
self.resident_size + self.swap_size
end
def capture(...)
Capture memory metrics for a process.
Signature
-
parameter
pidInteger The process ID.
-
parameter
optionsHash Additional options (e.g., count for proportional estimates).
-
returns
Memory A Memory instance with captured metrics.
Implementation
def capture(...)
return Memory::Darwin.capture(...)
end
def capture(...)
Capture memory metrics for a process.
Signature
-
parameter
pidInteger The process ID.
-
parameter
optionsHash Additional options.
-
returns
Memory A Memory instance with captured metrics.
Implementation
def capture(...)
return Memory::Linux.capture(...)
end
def self.capture(pid, **options)
Capture memory usage for the given process IDs.
Implementation
def self.capture(pid, **options)
return nil
end
def to_json(*arguments)
Convert the object to a JSON string.
Implementation
def to_json(*arguments)
as_json.to_json(*arguments)
end
def unique_size
The unique set size, the size of completely private (unshared) data.
Implementation
def unique_size
self.private_clean_size + self.private_dirty_size
end
def self.zero
Create a zero-initialized Memory instance.
Signature
-
returns
Memory A new Memory object with all fields set to zero.
Implementation
def self.zero
self.new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
end