module Metrics
Nested Classes and Modules
class GeneralGeneral process information.
module HostPer-host (system-wide) memory metrics. Use Host::Memory for total/used/free and swap; use Process::Metrics::Memory for per-process metrics.
class MemoryRepresents memory usage for a process, sizes are in bytes.
class ProcessorComputes interval CPU utilization from cumulative process metrics.
Definitions
def self.duration(value)
Parse a duration string into seconds. According to the linux manual page specifications.
Implementation
def self.duration(value)
if match = DURATION.match(value)
days = match[:days].to_i
hours = match[:hours].to_i
minutes = match[:minutes].to_i
seconds = match[:seconds].to_i
fraction = match[:fraction].to_i
return days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds + fraction / 100.0
else
return 0.0
end
end