Class: RailsPerformance::SystemMonitor::MemoryUsage
- Inherits:
-
ResourceChart
- Object
- Struct
- ResourceChart
- RailsPerformance::SystemMonitor::MemoryUsage
- Defined in:
- lib/rails_performance/system_monitor/resource_chart.rb
Instance Attribute Summary
Attributes inherited from ResourceChart
#description, #key, #legend, #server, #subtitle, #type
Instance Method Summary collapse
- #format(measurement) ⇒ Object
-
#initialize(server) ⇒ MemoryUsage
constructor
A new instance of MemoryUsage.
- #measure ⇒ Object
Methods inherited from ResourceChart
Constructor Details
#initialize(server) ⇒ MemoryUsage
Returns a new instance of MemoryUsage.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rails_performance/system_monitor/resource_chart.rb', line 52 def initialize server super( server:, key: :memory, type: "Usage", subtitle: "Memory", description: "App memory usage", legend: "Usage", ) end |
Instance Method Details
#format(measurement) ⇒ Object
63 64 65 |
# File 'lib/rails_performance/system_monitor/resource_chart.rb', line 63 def format measurement measurement.to_f.round(2) end |
#measure ⇒ Object
67 68 69 70 71 72 |
# File 'lib/rails_performance/system_monitor/resource_chart.rb', line 67 def measure GetProcessMem.new.bytes rescue => e ::Rails.logger.error "Error fetching memory usage: #{e.}" 0 end |