amdgpu_fan 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/config/icons.yml +2 -2
- data/lib/amdgpu_fan/cli.rb +23 -17
- data/lib/amdgpu_fan/service.rb +7 -3
- data/lib/amdgpu_fan/stat_set.rb +1 -1
- data/lib/amdgpu_fan/version.rb +1 -1
- data/lib/amdgpu_fan/watcher.rb +4 -3
- metadata +5 -61
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
|
[![Gem Version](https://badge.fury.io/rb/amdgpu_fan.svg)](https://badge.fury.io/rb/amdgpu_fan)
|
4
|
-
[![
|
4
|
+
[![Verify](https://github.com/HarlemSquirrel/amdgpu-fan-rb/actions/workflows/verify.yml/badge.svg)](https://github.com/HarlemSquirrel/amdgpu-fan-rb/actions/workflows/verify.yml)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/27233cee17ef6a2c14fd/maintainability)](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/config/icons.yml
CHANGED
data/lib/amdgpu_fan/cli.rb
CHANGED
@@ -9,10 +9,14 @@ 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
|
|
16
|
+
def self.exit_on_failure?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
16
20
|
desc 'connectors', 'View the status of the display connectors.'
|
17
21
|
def connectors
|
18
22
|
amdgpu_service.connectors.each do |connector|
|
@@ -58,19 +62,19 @@ module AmdgpuFan
|
|
58
62
|
desc 'status [--logo]', 'View device info, current fan speed, and temperature.'
|
59
63
|
def status(option = nil)
|
60
64
|
puts radeon_logo if option == '--logo'
|
61
|
-
puts ICONS[:gpu] + ' GPU:'.ljust(
|
62
|
-
puts ICONS[:vbios] + ' vBIOS:'.ljust(
|
63
|
-
puts "#{ICONS[:display]} Displays
|
64
|
-
puts ICONS[:clock] + ' Clocks:'.ljust(
|
65
|
-
puts ICONS[:memory] + ' Memory:'.ljust(
|
66
|
-
puts ICONS[:fan] + ' Fan:'.ljust(
|
67
|
-
puts ICONS[:temp] + ' Temp:'.ljust(
|
68
|
-
puts ICONS[:power] + ' Power:'.ljust(
|
65
|
+
puts ICONS[:gpu] + ' GPU:'.ljust(11) + amdgpu_service.name
|
66
|
+
puts ICONS[:vbios] + ' vBIOS:'.ljust(11) + amdgpu_service.vbios_version
|
67
|
+
puts "#{ICONS[:display]} Displays: #{amdgpu_service.display_names.join(', ')}"
|
68
|
+
puts ICONS[:clock] + ' Clocks:'.ljust(11) + clock_status
|
69
|
+
puts ICONS[:memory] + ' Memory:'.ljust(11) + mem_total_mibibyes
|
70
|
+
puts ICONS[:fan] + ' Fan:'.ljust(11) + fan_status
|
71
|
+
puts ICONS[:temp] + ' Temp:'.ljust(11) + "#{amdgpu_service.temperature}°C"
|
72
|
+
puts ICONS[:power] + ' Power:'.ljust(11) +
|
69
73
|
"#{amdgpu_service.profile_mode} profile in " \
|
70
74
|
"#{amdgpu_service.power_dpm_state} mode using " \
|
71
|
-
"#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts "\
|
75
|
+
"#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts " \
|
72
76
|
"(#{amdgpu_service.power_draw_percent}%)"
|
73
|
-
puts ICONS[:load] + ' Load:'.ljust(
|
77
|
+
puts ICONS[:load] + ' Load:'.ljust(11) + percent_meter(amdgpu_service.busy_percent, 12)
|
74
78
|
end
|
75
79
|
|
76
80
|
desc 'version', 'Print the application version.'
|
@@ -121,9 +125,10 @@ module AmdgpuFan
|
|
121
125
|
|
122
126
|
loop do
|
123
127
|
watcher.measure
|
124
|
-
|
128
|
+
6.times { print "\033[K\033[A" } # move up a line and clear to end of line
|
125
129
|
|
126
|
-
puts "#{ICONS[:
|
130
|
+
puts "#{ICONS[:load]} Load #{watcher.busy_percent}",
|
131
|
+
"#{ICONS[:clock]} Core clock #{watcher.core_clock}",
|
127
132
|
"#{ICONS[:memory]} Memory clk #{watcher.memory_clock}",
|
128
133
|
"#{ICONS[:fan]} Fan speed #{watcher.fan_speed_rpm}",
|
129
134
|
"#{ICONS[:power]} Power usage #{watcher.power_draw}",
|
@@ -137,7 +142,7 @@ module AmdgpuFan
|
|
137
142
|
def watch_csv(seconds = 1)
|
138
143
|
return puts 'Seconds must be from 1 to 600' unless (1..600).cover?(seconds.to_i)
|
139
144
|
|
140
|
-
puts 'Timestamp,Core Clock (Mhz),Memory Clock (Mhz),Fan speed (rpm),'\
|
145
|
+
puts 'Timestamp,Core Clock (Mhz),Memory Clock (Mhz),Fan speed (rpm),' \
|
141
146
|
'Load (%),Power (Watts),Temp (°C)'
|
142
147
|
|
143
148
|
trap 'SIGINT' do
|
@@ -165,6 +170,7 @@ module AmdgpuFan
|
|
165
170
|
private
|
166
171
|
|
167
172
|
def amdgpu_service
|
173
|
+
# Right now we're only looking at the first card.
|
168
174
|
@amdgpu_service ||= AmdgpuFan::Service.new
|
169
175
|
end
|
170
176
|
|
@@ -186,7 +192,7 @@ module AmdgpuFan
|
|
186
192
|
end
|
187
193
|
|
188
194
|
def summary_clock
|
189
|
-
"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}" \
|
190
196
|
"Memory: #{amdgpu_service.memory_clock.to_s.rjust(7)}"
|
191
197
|
end
|
192
198
|
|
@@ -200,8 +206,8 @@ module AmdgpuFan
|
|
200
206
|
end
|
201
207
|
|
202
208
|
def summary_power
|
203
|
-
"Power: #{format('%<num>0.02f', num: amdgpu_service.power_draw).rjust(power_max.length)} W" \
|
204
|
-
"
|
209
|
+
"Power: #{format('%<num>0.02f', num: amdgpu_service.power_draw).rjust(power_max.length)} W " \
|
210
|
+
"#{percent_meter amdgpu_service.power_draw_percent}"
|
205
211
|
end
|
206
212
|
|
207
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/stat_set.rb
CHANGED
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
|
@@ -30,70 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
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'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
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.8'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.8'
|
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.1'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.1'
|
40
|
+
version: '1.2'
|
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
|