mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-28 02:11:40 +00:00
Add NPU usage to metrics on supported platforms (#1215)
This commit is contained in:
@@ -92,6 +92,10 @@ public class MetricsManager {
|
||||
return safeExecute(cmds.cpuThrottleReasonCmd);
|
||||
}
|
||||
|
||||
public String getNpuUsage() {
|
||||
return safeExecute(cmds.npuUsageCommand);
|
||||
}
|
||||
|
||||
private String gpuMemSave = null;
|
||||
|
||||
public String getGPUMemorySplit() {
|
||||
@@ -128,6 +132,7 @@ public class MetricsManager {
|
||||
metrics.put("ramUtil", this.getUsedRam());
|
||||
metrics.put("gpuMemUtil", this.getMallocedMemory());
|
||||
metrics.put("diskUtilPct", this.getUsedDiskPct());
|
||||
metrics.put("npuUsage", this.getNpuUsage());
|
||||
|
||||
DataChangeService.getInstance().publishEvent(OutgoingUIEvent.wrappedOf("metrics", metrics));
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public class CmdBase {
|
||||
// GPU
|
||||
public String gpuMemoryCommand = "";
|
||||
public String gpuMemUsageCommand = "";
|
||||
// NPU
|
||||
public String npuUsageCommand = "";
|
||||
// RAM
|
||||
public String ramUsageCommand = "";
|
||||
// Disk
|
||||
|
||||
@@ -44,5 +44,7 @@ public class RK3588Cmds extends LinuxCmds {
|
||||
*/
|
||||
cpuTemperatureCommand =
|
||||
"cat /sys/class/thermal/thermal_zone1/temp | awk '{printf \"%.1f\", $1/1000}'";
|
||||
|
||||
npuUsageCommand = "cat /sys/kernel/debug/rknpu/load | sed 's/NPU load://; s/^ *//; s/ *$//'";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user