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
-
#busy_percent ⇒ Object
readonly
Returns the value of attribute busy_percent.
-
#core_clock ⇒ Object
readonly
Returns the value of attribute core_clock.
-
#fan_speed_rpm ⇒ Object
readonly
Returns the value of attribute fan_speed_rpm.
-
#memory_clock ⇒ Object
readonly
Returns the value of attribute memory_clock.
-
#num_measurements ⇒ Object
readonly
Returns the value of attribute num_measurements.
-
#power_draw ⇒ Object
readonly
Returns the value of attribute power_draw.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
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.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/amdgpu_fan/watcher.rb', line 13 def initialize(amdgpu_service) @amdgpu_service = amdgpu_service @num_measurements = 0 @core_clock = StatSet.new 'MHz' @memory_clock = StatSet.new 'MHz' @fan_speed_rpm = StatSet.new 'RPM' @busy_percent = StatSet.new '%' @power_draw = StatSet.new 'W' @temperature = StatSet.new '°C' end |
Instance Attribute Details
#busy_percent ⇒ Object (readonly)
Returns the value of attribute busy_percent.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def busy_percent @busy_percent end |
#core_clock ⇒ Object (readonly)
Returns the value of attribute core_clock.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def core_clock @core_clock end |
#fan_speed_rpm ⇒ Object (readonly)
Returns the value of attribute fan_speed_rpm.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def fan_speed_rpm @fan_speed_rpm end |
#memory_clock ⇒ Object (readonly)
Returns the value of attribute memory_clock.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def memory_clock @memory_clock end |
#num_measurements ⇒ Object (readonly)
Returns the value of attribute num_measurements.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def num_measurements @num_measurements end |
#power_draw ⇒ Object (readonly)
Returns the value of attribute power_draw.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def power_draw @power_draw end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
10 11 12 |
# File 'lib/amdgpu_fan/watcher.rb', line 10 def temperature @temperature end |
Instance Method Details
#measure ⇒ Object
Take a new set of measurements and adjust the stats.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/amdgpu_fan/watcher.rb', line 28 def measure @num_measurements += 1 Async do |task| i[busy_percent core_clock fan_speed_rpm memory_clock power_draw temperature].each do |stat| task.async do send(stat).now = amdgpu_service.send(stat) calculate_stats(send(stat)) end end end end |