diff --git a/.idea/i3pystatus.iml b/.idea/i3pystatus.iml
new file mode 100644
index 0000000..f3d7bc9
--- /dev/null
+++ b/.idea/i3pystatus.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..a2e120d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..5113f51
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..7b43000
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1552567658841
+
+
+ 1552567658841
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/i3pystatus/amdgpu.py b/i3pystatus/amdgpu.py
index 50e0e00..14f2fdc 100644
--- a/i3pystatus/amdgpu.py
+++ b/i3pystatus/amdgpu.py
@@ -10,8 +10,10 @@ class Amdgpu(IntervalModule):
.. rubric :: Available formatters
* `{temp}`
- * `{sclk}` - Gpu clock speed
- * `{mclk}` - Memory clock speed
+ * `{sclk}` - Gpu clock speed
+ * `{mclk}` - Memory clock speed
+ * `{fan_speed}` - Fan speed
+ * `{gpu_usage}` - Gpu Usage percent
"""
settings = (
@@ -23,19 +25,33 @@ class Amdgpu(IntervalModule):
format = '{temp} {mclk} {sclk}'
def init(self):
+ self.info_gatherers = []
self.dev_path = '/sys/class/drm/card{}/device/'.format(self.card)
self.detect_hwmon()
+ if 'sclk' in self.format:
+ self.info_gatherers.append(self.get_sclk)
+
+ if 'mclk' in self.format:
+ self.info_gatherers.append(self.get_mclk)
+
+ if 'temp' in self.format:
+ self.info_gatherers.append(self.get_temp)
+
+ if 'fan_speed' in self.format:
+ self.info_gatherers.append(self.get_fan_speed)
+
+ if 'gpu_usage' in self.format:
+ self.info_gatherers.append(self.get_gpu_usage)
def detect_hwmon(self):
hwmon_base = self.dev_path + 'hwmon/'
- self.hwmmon_path = hwmon_base + os.listdir(hwmon_base)[0] + '/'
+ self.hwmon_path = hwmon_base + os.listdir(hwmon_base)[0] + '/'
def run(self):
- self.data = dict(
- sclk=self.get_sclk(),
- mclk=self.get_mclk(),
- temp=self.get_temp()
- )
+ self.data = dict()
+
+ for gatherer in self.info_gatherers:
+ gatherer()
self.output = {
'full_text': self.format.format(**self.data)
@@ -49,12 +65,20 @@ class Amdgpu(IntervalModule):
def get_mclk(self):
with open(self.dev_path + 'pp_dpm_mclk') as f:
- return self.parse_clk_reading(f.read())
+ self.data['mclk'] = self.parse_clk_reading(f.read())
def get_sclk(self):
with open(self.dev_path + 'pp_dpm_sclk') as f:
- return self.parse_clk_reading(f.read())
+ self.data['sclk'] = self.parse_clk_reading(f.read())
def get_temp(self):
- with open(self.hwmmon_path + 'temp1_input') as f:
- return float(f.read()) / 1000
+ with open(self.hwmon_path + 'temp1_input') as f:
+ self.data['temp'] = float(f.read()) / 1000
+
+ def get_fan_speed(self):
+ with open(self.hwmon_path + 'fan1_input') as f:
+ self.data['fan_speed'] = f.read().strip()
+
+ def get_gpu_usage(self):
+ with open(self.dev_path + 'gpu_busy_percent') as f:
+ self.data['gpu_usage'] = f.read().strip()