Log gpu usage (#21404)
* Log gpu usage * 100 total * bump cereal Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>pull/21440/head
parent
325cabd4da
commit
ad7f0207ac
2
cereal
2
cereal
|
@ -1 +1 @@
|
|||
Subproject commit 232e28c2bb049fa8b7c2da0a2add27645b5a6bc2
|
||||
Subproject commit e1793a1854eb5f76a304b30ee96dee5a0f0b2cc4
|
|
@ -113,3 +113,7 @@ class HardwareBase:
|
|||
@abstractmethod
|
||||
def set_power_save(self, enabled):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_gpu_usage_percent(self):
|
||||
pass
|
||||
|
|
|
@ -377,3 +377,6 @@ class Android(HardwareBase):
|
|||
|
||||
def set_power_save(self, enabled):
|
||||
pass
|
||||
|
||||
def get_gpu_usage_percent(self):
|
||||
return 0
|
||||
|
|
|
@ -85,3 +85,6 @@ class Pc(HardwareBase):
|
|||
|
||||
def set_power_save(self, enabled):
|
||||
pass
|
||||
|
||||
def get_gpu_usage_percent(self):
|
||||
return 0
|
||||
|
|
|
@ -262,3 +262,10 @@ class Tici(HardwareBase):
|
|||
# TODO: fix permissions with udev
|
||||
val = "0" if enabled else "1"
|
||||
os.system(f"sudo su -c 'echo {val} > /sys/devices/system/cpu/cpu{i}/online'")
|
||||
|
||||
def get_gpu_usage_percent(self):
|
||||
try:
|
||||
used, total = open('/sys/class/kgsl/kgsl-3d0/gpubusy').read().strip().split()
|
||||
return 100.0 * int(used) / int(total)
|
||||
except Exception:
|
||||
return 0
|
||||
|
|
|
@ -265,6 +265,7 @@ def thermald_thread():
|
|||
msg.deviceState.freeSpacePercent = get_available_percent(default=100.0)
|
||||
msg.deviceState.memoryUsagePercent = int(round(psutil.virtual_memory().percent))
|
||||
msg.deviceState.cpuUsagePercent = int(round(psutil.cpu_percent()))
|
||||
msg.deviceState.gpuUsagePercent = int(round(HARDWARE.get_gpu_usage_percent()))
|
||||
msg.deviceState.networkType = network_type
|
||||
msg.deviceState.networkStrength = network_strength
|
||||
if network_info is not None:
|
||||
|
|
Loading…
Reference in New Issue