amdgpu_fan 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/amdgpu_fan/cli.rb +10 -8
- data/lib/amdgpu_fan/service.rb +7 -3
- data/lib/amdgpu_fan/version.rb +1 -1
- data/lib/amdgpu_fan/watcher.rb +4 -3
- metadata +3 -59
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c56a24ac7feceacab33c70e7a59e6126653f9a8507f468a3ea948e2372b24ec1
|
|
4
|
+
data.tar.gz: 4c5b6634b9d805d0bcf5de22346b6865aae9d54aea515f75c25ff5476916de6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fb3898d03b55097970f1cbffb1a9fe813e463564e905fa23025161aa783e73dfd9b03e0cd6842c2b69fc1552fbbd11cebcc8318a139e33d5868cc41a30023a8
|
|
7
|
+
data.tar.gz: 6b8417efa976498f35d2fdc5eb4c8360f38a8a645c0b5b1586a5b6f190cacbb07360c2da76be56123cf49838ae483e760eeebaefe84e38d9d44eda1ba03de5ac
|
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# amdgpu_fan
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/amdgpu_fan)
|
|
4
|
-
[](https://github.com/HarlemSquirrel/amdgpu-fan-rb/actions/workflows/verify.yml)
|
|
5
|
+
[](https://codeclimate.com/github/HarlemSquirrel/amdgpu-fan-rb/maintainability)
|
|
5
6
|
|
|
6
7
|
A Ruby CLI to read and set fan speed, power profiles, and more for AMD Radeon graphics cards running on the AMDGPU Linux driver.
|
|
7
8
|
|
data/lib/amdgpu_fan/cli.rb
CHANGED
|
@@ -9,7 +9,7 @@ module AmdgpuFan
|
|
|
9
9
|
class Cli < Thor
|
|
10
10
|
include CliOutputFormat
|
|
11
11
|
|
|
12
|
-
ICONS = YAML.
|
|
12
|
+
ICONS = YAML.safe_load_file(File.join(__dir__, '../../config/icons.yml'))
|
|
13
13
|
.transform_keys(&:to_sym).freeze
|
|
14
14
|
WATCH_FIELD_SEPARATOR = ' | '
|
|
15
15
|
|
|
@@ -72,7 +72,7 @@ module AmdgpuFan
|
|
|
72
72
|
puts ICONS[:power] + ' Power:'.ljust(11) +
|
|
73
73
|
"#{amdgpu_service.profile_mode} profile in " \
|
|
74
74
|
"#{amdgpu_service.power_dpm_state} mode using " \
|
|
75
|
-
"#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts "\
|
|
75
|
+
"#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts " \
|
|
76
76
|
"(#{amdgpu_service.power_draw_percent}%)"
|
|
77
77
|
puts ICONS[:load] + ' Load:'.ljust(11) + percent_meter(amdgpu_service.busy_percent, 12)
|
|
78
78
|
end
|
|
@@ -125,9 +125,10 @@ module AmdgpuFan
|
|
|
125
125
|
|
|
126
126
|
loop do
|
|
127
127
|
watcher.measure
|
|
128
|
-
|
|
128
|
+
6.times { print "\033[K\033[A" } # move up a line and clear to end of line
|
|
129
129
|
|
|
130
|
-
puts "#{ICONS[:
|
|
130
|
+
puts "#{ICONS[:load]} Load #{watcher.busy_percent}",
|
|
131
|
+
"#{ICONS[:clock]} Core clock #{watcher.core_clock}",
|
|
131
132
|
"#{ICONS[:memory]} Memory clk #{watcher.memory_clock}",
|
|
132
133
|
"#{ICONS[:fan]} Fan speed #{watcher.fan_speed_rpm}",
|
|
133
134
|
"#{ICONS[:power]} Power usage #{watcher.power_draw}",
|
|
@@ -141,7 +142,7 @@ module AmdgpuFan
|
|
|
141
142
|
def watch_csv(seconds = 1)
|
|
142
143
|
return puts 'Seconds must be from 1 to 600' unless (1..600).cover?(seconds.to_i)
|
|
143
144
|
|
|
144
|
-
puts 'Timestamp,Core Clock (Mhz),Memory Clock (Mhz),Fan speed (rpm),'\
|
|
145
|
+
puts 'Timestamp,Core Clock (Mhz),Memory Clock (Mhz),Fan speed (rpm),' \
|
|
145
146
|
'Load (%),Power (Watts),Temp (°C)'
|
|
146
147
|
|
|
147
148
|
trap 'SIGINT' do
|
|
@@ -169,6 +170,7 @@ module AmdgpuFan
|
|
|
169
170
|
private
|
|
170
171
|
|
|
171
172
|
def amdgpu_service
|
|
173
|
+
# Right now we're only looking at the first card.
|
|
172
174
|
@amdgpu_service ||= AmdgpuFan::Service.new
|
|
173
175
|
end
|
|
174
176
|
|
|
@@ -190,7 +192,7 @@ module AmdgpuFan
|
|
|
190
192
|
end
|
|
191
193
|
|
|
192
194
|
def summary_clock
|
|
193
|
-
"Core: #{amdgpu_service.core_clock.to_s.rjust(7)}#{WATCH_FIELD_SEPARATOR}"\
|
|
195
|
+
"Core: #{amdgpu_service.core_clock.to_s.rjust(7)}#{WATCH_FIELD_SEPARATOR}" \
|
|
194
196
|
"Memory: #{amdgpu_service.memory_clock.to_s.rjust(7)}"
|
|
195
197
|
end
|
|
196
198
|
|
|
@@ -204,8 +206,8 @@ module AmdgpuFan
|
|
|
204
206
|
end
|
|
205
207
|
|
|
206
208
|
def summary_power
|
|
207
|
-
"Power: #{format('%<num>0.02f', num: amdgpu_service.power_draw).rjust(power_max.length)} W" \
|
|
208
|
-
"
|
|
209
|
+
"Power: #{format('%<num>0.02f', num: amdgpu_service.power_draw).rjust(power_max.length)} W " \
|
|
210
|
+
"#{percent_meter amdgpu_service.power_draw_percent}"
|
|
209
211
|
end
|
|
210
212
|
|
|
211
213
|
def summary_temp
|
data/lib/amdgpu_fan/service.rb
CHANGED
|
@@ -22,12 +22,16 @@ module AmdgpuFan
|
|
|
22
22
|
|
|
23
23
|
class Error < StandardError; end
|
|
24
24
|
|
|
25
|
-
def
|
|
26
|
-
|
|
25
|
+
def self.card_numbers
|
|
26
|
+
Dir["#{BASE_FOLDER}/card*"].filter_map { |path| path.split('/').last.slice(/(?<=card)\d+\Z/) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def initialize(card_num: nil)
|
|
30
|
+
@card_num = card_num || self.class.card_numbers.first
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def busy_percent
|
|
30
|
-
File.read("#{base_card_dir}/gpu_busy_percent").strip
|
|
34
|
+
File.read("#{base_card_dir}/gpu_busy_percent").strip.to_i
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
def connectors
|
data/lib/amdgpu_fan/version.rb
CHANGED
data/lib/amdgpu_fan/watcher.rb
CHANGED
|
@@ -7,8 +7,8 @@ require_relative 'stat_set'
|
|
|
7
7
|
module AmdgpuFan
|
|
8
8
|
# Keep track of stats over time.
|
|
9
9
|
class Watcher
|
|
10
|
-
attr_reader :core_clock, :fan_speed_rpm, :
|
|
11
|
-
:temperature
|
|
10
|
+
attr_reader :core_clock, :fan_speed_rpm, :busy_percent, :num_measurements, :memory_clock,
|
|
11
|
+
:power_draw, :temperature
|
|
12
12
|
|
|
13
13
|
def initialize(amdgpu_service)
|
|
14
14
|
@amdgpu_service = amdgpu_service
|
|
@@ -17,6 +17,7 @@ module AmdgpuFan
|
|
|
17
17
|
@core_clock = StatSet.new 'MHz'
|
|
18
18
|
@memory_clock = StatSet.new 'MHz'
|
|
19
19
|
@fan_speed_rpm = StatSet.new 'RPM'
|
|
20
|
+
@busy_percent = StatSet.new '%'
|
|
20
21
|
@power_draw = StatSet.new 'W'
|
|
21
22
|
@temperature = StatSet.new '°C'
|
|
22
23
|
end
|
|
@@ -28,7 +29,7 @@ module AmdgpuFan
|
|
|
28
29
|
@num_measurements += 1
|
|
29
30
|
|
|
30
31
|
Async do |task|
|
|
31
|
-
%i[core_clock fan_speed_rpm memory_clock power_draw temperature].each do |stat|
|
|
32
|
+
%i[busy_percent core_clock fan_speed_rpm memory_clock power_draw temperature].each do |stat|
|
|
32
33
|
task.async do
|
|
33
34
|
send(stat).now = amdgpu_service.send(stat)
|
|
34
35
|
calculate_stats(send(stat))
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amdgpu_fan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin McCormack
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async
|
|
@@ -38,62 +38,6 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '1.2'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: pry
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0.14'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0.14'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rspec
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '3.10'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '3.10'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rubocop
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1.24'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '1.24'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rubocop-rspec
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - "~>"
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '2.7'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - "~>"
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '2.7'
|
|
97
41
|
description: A CLI for interacting with the amdgpu Linux driver
|
|
98
42
|
email: harlemsquirrel@gmail.com
|
|
99
43
|
executables:
|
|
@@ -136,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
80
|
- !ruby/object:Gem::Version
|
|
137
81
|
version: '0'
|
|
138
82
|
requirements: []
|
|
139
|
-
rubygems_version: 3.
|
|
83
|
+
rubygems_version: 3.4.10
|
|
140
84
|
signing_key:
|
|
141
85
|
specification_version: 4
|
|
142
86
|
summary: A CLI to view and set fan speeds for AMD graphics cards running on the open
|