diff --git a/rpi-gpu-usage/README.md b/rpi-gpu-usage/README.md index 592e35c..8806669 100644 --- a/rpi-gpu-usage/README.md +++ b/rpi-gpu-usage/README.md @@ -22,16 +22,16 @@ information to find the processes that have drm stats information like: ``` The application then outputs total GPU usage for the renderer (shaders) -tfu (texture format unit) and binning blocks. It also reads the total CPU -usage for that process. +tfu (texture format unit), binning, csd (compute shader dispatch) and +cache_clean blocks. It also reads the total CPU usage for that process. ``` GPU Utilisation -Client PID Process render tfu bin CPU ----------------------------------------------------------------------- - 14 2215 labwc 13.2% 0.0% 0.3% 18.7% - 38 10668 chromium 0.0% 0.0% 0.0% 0.0% +Client PID Process render tfu bin csd clean CPU +------------------------------------------------------------------------------ + 14 2215 labwc 13.2% 0.0% 0.3% 0.0% 0.0% 18.7% + 187 10982 litert-lm 0.0% 0.0% 0.0% 99.8% 0.2% 99.4% ``` **Command line options** diff --git a/rpi-gpu-usage/rpi-gpu-usage.1 b/rpi-gpu-usage/rpi-gpu-usage.1 index e5fae42..bd39739 100644 --- a/rpi-gpu-usage/rpi-gpu-usage.1 +++ b/rpi-gpu-usage/rpi-gpu-usage.1 @@ -11,7 +11,15 @@ It reads per-process GPU engine times from DRM fdinfo and global utilisation from the V3D gpu_stats sysfs interface. .PP The display is refreshed once per second, showing per-client -GPU engine usage (render, tfu, bin) and CPU usage. +GPU engine usage (render, tfu, bin, csd, cache_clean) and CPU usage. +.PP +Note that compute workloads (OpenCL, Vulkan compute, ML inference) +run on the +.B csd +queue rather than the render queue, so they will only be visible in +the +.B csd +column. .SH OPTIONS .TP .B \-\-csv diff --git a/rpi-gpu-usage/rpi-gpu-usage.c b/rpi-gpu-usage/rpi-gpu-usage.c index 4f4005f..4509842 100644 --- a/rpi-gpu-usage/rpi-gpu-usage.c +++ b/rpi-gpu-usage/rpi-gpu-usage.c @@ -21,11 +21,13 @@ #define MAX_CLIENTS 256 #define MAX_COMM 64 -/* Engine indices for the three we display */ -#define ENG_RENDER 0 -#define ENG_TFU 1 -#define ENG_BIN 2 -#define N_ENGINES 3 +/* Engine indices for the queues we display */ +#define ENG_RENDER 0 +#define ENG_TFU 1 +#define ENG_BIN 2 +#define ENG_CSD 3 +#define ENG_CACHE_CLEAN 4 +#define N_ENGINES 5 struct client { int id; @@ -123,9 +125,11 @@ static double read_proc_cpu(int pid) /* Map fdinfo engine name to our index, or -1 */ static int engine_idx(const char *name) { - if (strcmp(name, "render") == 0) return ENG_RENDER; - if (strcmp(name, "tfu") == 0) return ENG_TFU; - if (strcmp(name, "bin") == 0) return ENG_BIN; + if (strcmp(name, "render") == 0) return ENG_RENDER; + if (strcmp(name, "tfu") == 0) return ENG_TFU; + if (strcmp(name, "bin") == 0) return ENG_BIN; + if (strcmp(name, "csd") == 0) return ENG_CSD; + if (strcmp(name, "cache_clean") == 0) return ENG_CACHE_CLEAN; return -1; } @@ -295,7 +299,7 @@ int main(int argc, char *argv[]) curs_set(0); } else { printf("timestamp,client_id,pid,process," - "render%%,tfu%%,bin%%,cpu%%\n"); + "render%%,tfu%%,bin%%,csd%%,cache_clean%%,cpu%%\n"); } struct client prev[MAX_CLIENTS], curr[MAX_CLIENTS]; @@ -322,11 +326,11 @@ int main(int argc, char *argv[]) if (!csv) { clear(); mvprintw(0, 0, "GPU Utilisation\n\n"); - printw("%6s %-8s %-16s %8s %8s %8s %8s\n", + printw("%6s %-7s %-14s %7s %7s %7s %7s %7s %7s\n", "Client", "PID", "Process", - "render", "tfu", "bin", "CPU"); + "render", "tfu", "bin", "csd", "clean", "CPU"); printw("----------------------------------------------" - "------------------------\n"); + "--------------------------------\n"); } for (int i = 0; i < ncurr; i++) { @@ -344,15 +348,17 @@ int main(int argc, char *argv[]) double cpct = wall_dt > 0 ? cpu_d / wall_dt * 100.0 : 0.0; if (csv) - printf("%.3f,%d,%d,%s,%.1f,%.1f,%.1f,%.1f\n", + printf("%.3f,%d,%d,%s,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f\n", curr_wall, c->id, c->pid, c->comm, pcts[ENG_RENDER], pcts[ENG_TFU], pcts[ENG_BIN], + pcts[ENG_CSD], pcts[ENG_CACHE_CLEAN], cpct); else - printw("%6d %-8d %-16s" - " %7.1f%% %7.1f%% %7.1f%% %7.1f%%\n", + printw("%6d %-7d %-14s" + " %6.1f%% %6.1f%% %6.1f%% %6.1f%% %6.1f%% %6.1f%%\n", c->id, c->pid, c->comm, pcts[ENG_RENDER], pcts[ENG_TFU], pcts[ENG_BIN], + pcts[ENG_CSD], pcts[ENG_CACHE_CLEAN], cpct); }