File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ def fps() -> int:
6666 def fan_percent () -> float :
6767 pass
6868
69+ @staticmethod
70+ @abstractmethod
71+ def frequency () -> float :
72+ pass
73+
6974 @staticmethod
7075 @abstractmethod
7176 def is_available () -> bool :
Original file line number Diff line number Diff line change @@ -330,6 +330,23 @@ def fan_percent(cls) -> float:
330330 # No Fan Speed sensor for this GPU model
331331 return math .nan
332332
333+ @classmethod
334+ def frequency (cls ) -> float :
335+ gpu_to_use = cls .get_gpu_to_use ()
336+ if gpu_to_use is None :
337+ # GPU not supported
338+ return math .nan
339+
340+ try :
341+ for sensor in gpu_to_use .Sensors :
342+ if sensor .SensorType == Hardware .SensorType .Control :
343+ pass
344+ except :
345+ pass
346+
347+ # No Frequency sensor for this GPU model
348+ return math .nan
349+
333350 @classmethod
334351 def is_available (cls ) -> bool :
335352 cls .gpu_name = get_gpu_name ()
Original file line number Diff line number Diff line change @@ -176,6 +176,16 @@ def fan_percent() -> float:
176176 else :
177177 return math .nan
178178
179+ @staticmethod
180+ def frequency () -> float :
181+ global DETECTED_GPU
182+ if DETECTED_GPU == GpuType .AMD :
183+ return GpuAmd .frequency ()
184+ elif DETECTED_GPU == GpuType .NVIDIA :
185+ return GpuNvidia .frequency ()
186+ else :
187+ return math .nan
188+
179189 @staticmethod
180190 def is_available () -> bool :
181191 global DETECTED_GPU
@@ -247,6 +257,11 @@ def fan_percent() -> float:
247257
248258 return math .nan
249259
260+ @staticmethod
261+ def frequency () -> float :
262+ # Not supported by Python libraries
263+ return math .nan
264+
250265 @staticmethod
251266 def is_available () -> bool :
252267 try :
@@ -331,6 +346,11 @@ def fan_percent() -> float:
331346
332347 return math .nan
333348
349+ @staticmethod
350+ def frequency () -> float :
351+ # Not supported by Python libraries
352+ return math .nan
353+
334354 @staticmethod
335355 def is_available () -> bool :
336356 try :
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ def fps() -> int:
6060 def fan_percent () -> float :
6161 return random .uniform (0 , 100 )
6262
63+ @staticmethod
64+ def frequency () -> float :
65+ return random .uniform (800 , 3400 )
66+
6367 @staticmethod
6468 def is_available () -> bool :
6569 return True
Original file line number Diff line number Diff line change 3535GPU_MEM_TOTAL_SIZE_GB = 32
3636NETWORK_SPEED_BYTES = 1061000000
3737GPU_FPS = 120
38+ GPU_FREQ_MHZ = 1500.0
3839
3940
4041class Cpu (sensors .Cpu ):
@@ -73,6 +74,10 @@ def fps() -> int:
7374 def fan_percent () -> float :
7475 return PERCENTAGE_SENSOR_VALUE
7576
77+ @staticmethod
78+ def frequency () -> float :
79+ return GPU_FREQ_MHZ
80+
7681 @staticmethod
7782 def is_available () -> bool :
7883 return True
You can’t perform that action at this time.
0 commit comments