Class: AmdgpuFan::Watcher
- Inherits:
-
Object
- Object
- AmdgpuFan::Watcher
- Defined in:
- lib/amdgpu_fan/watcher.rb
Overview
Keep track of stats over time.
Instance Attribute Summary collapse
-
#core_clock ⇒ Object
readonly
Returns the value of attribute core_clock.
-
#fan_speed ⇒ Object
readonly
Returns the value of attribute fan_speed.
-
#mem_clock ⇒ Object
readonly
Returns the value of attribute mem_clock.
-
#num_measurements ⇒ Object
readonly
Returns the value of attribute num_measurements.
-
#power ⇒ Object
readonly
Returns the value of attribute power.
-
#temp ⇒ Object
readonly
Returns the value of attribute temp.
Instance Method Summary collapse
-
#initialize(amdgpu_service) ⇒ Watcher
constructor
A new instance of Watcher.
-
#measure ⇒ Object
Take a new set of measurements and adjust the stats.
Constructor Details
#initialize(amdgpu_service) ⇒ Watcher
Returns a new instance of Watcher.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def initialize(amdgpu_service) @amdgpu_service = amdgpu_service @num_measurements = 0 @core_clock = StatSet.new 'MHz' @mem_clock = StatSet.new 'MHz' @fan_speed = StatSet.new 'RPM' @power = StatSet.new 'W' @temp = StatSet.new '°C' end |
Instance Attribute Details
#core_clock ⇒ Object (readonly)
Returns the value of attribute core_clock.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def core_clock @core_clock end |
#fan_speed ⇒ Object (readonly)
Returns the value of attribute fan_speed.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def fan_speed @fan_speed end |
#mem_clock ⇒ Object (readonly)
Returns the value of attribute mem_clock.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def mem_clock @mem_clock end |
#num_measurements ⇒ Object (readonly)
Returns the value of attribute num_measurements.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def num_measurements @num_measurements end |
#power ⇒ Object (readonly)
Returns the value of attribute power.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def power @power end |
#temp ⇒ Object (readonly)
Returns the value of attribute temp.
8 9 10 |
# File 'lib/amdgpu_fan/watcher.rb', line 8 def temp @temp end |
Instance Method Details
#measure ⇒ Object
Take a new set of measurements and adjust the stats.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/amdgpu_fan/watcher.rb', line 24 def measure @num_measurements += 1 @core_clock.now = @amdgpu_service.core_clock.to_i @mem_clock.now = @amdgpu_service.memory_clock.to_i @fan_speed.now = @amdgpu_service.fan_speed_rpm.to_i @power.now = @amdgpu_service.power_draw.to_f @temp.now = @amdgpu_service.temperature.to_i [@core_clock, @mem_clock, @fan_speed, @power, @temp].each do |stat_set| calculate_stats(stat_set) end end |