- fix GPU detecting when 2 cards have the same driver (#143)

- processing GPUs with a generic model name (#109)
- add debug argument which allows saving some logs to the file (/Documents/log.txt)
This commit is contained in:
Serhiy Mytrovtsiy
2020-11-06 08:40:48 +01:00
parent a3ff3f3658
commit d62ebabb2b
7 changed files with 119 additions and 59 deletions

View File

@@ -14,8 +14,8 @@ import ModuleKit
import StatsKit
public struct GPU_Info {
public let name: String
public let IOclass: String
public let model: String
public let IOClass: String
public var state: Bool = false
public var utilization: Double = 0
@@ -30,7 +30,7 @@ public struct GPUs: value_t {
}
internal func igpu() -> GPU_Info? {
return self.active().first{ $0.IOclass == "IntelAccelerator" }
return self.active().first{ $0.IOClass == "IntelAccelerator" }
}
public var widget_value: Double {
@@ -95,7 +95,7 @@ public class GPU: Module {
self.settingsView.setList(value!)
let activeGPU = value!.active()
let selectedGPU = activeGPU.first{ $0.name == self.selectedGPU } ?? value!.igpu() ?? value!.list[0]
let selectedGPU = activeGPU.first{ $0.model == self.selectedGPU } ?? value!.igpu() ?? value!.list[0]
if let widget = self.widget as? Mini {
widget.setValue(selectedGPU.utilization)