Normally using grep would do the trick
sudo intel_gpu_top | grep xyz
But in this case intel_gpu_top is like htop and runs constantly.
How would i extract the needed information inside a bash script?
I want to get my average iGPU usage and it seems like this is the only tool that can do that. While there is an option to output the results into a file, sudo intel_gpu_top -o file.txt
it is rather weirdly made, it has different statistics and it doesnt override the old result manually but rather adds more to the file making it difficult to read the information needed from that file (atleast for a bash noobie like me)
EDIT:
Here is the output from sudo intel_gpu_top -o test.txt
Freq MHz IRQ RC6 Power IMC MiB/s RCS/0 BCS/0 VCS/0 VECS/0
req act /s % W rd wr % se wa % se wa % se wa % se wa
0 0 0 0 0.00 170 48 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0
6 6 12 99 0.01 545 134 0.81 0 0 0.00 0 0 0.00 0 0 0.00 0 0
9 9 14 98 0.01 411 78 1.14 0 0 0.00 0 0 0.00 0 0 0.00 0 0
5 5 10 99 0.01 436 74 0.72 0 0 0.00 0 0 0.00 0 0 0.00 0 0
12 12 21 98 0.01 431 100 0.76 0 0 0.00 0 0 0.00 0 0 0.00 0 0
3 3 8 100 0.00 391 52 0.16 0 0 0.00 0 0 0.00 0 0 0.00 0 0
and here from the sudo intel_gpu_top, dont forget that this will display like htop or top
intel-gpu-top - 9/ 9 MHz; 98% RC6; 0.02 Watts; 17 irqs/s
IMC reads: 732 MiB/s
IMC writes: 247 MiB/s
ENGINE BUSY MI_SEMA MI_WAIT
Render/3D/0 1.65% |█▍ | 0% 0%
Blitter/0 0.00% | | 0% 0%
Video/0 0.00% | | 0% 0%
VideoEnhance/0 0.00% | | 0% 0%
Im interrested in the Render/3D/0, Blitter/0, Video/0 and VideoEnhance/0 values. I have actually no idea how both outputs are relative to each other but yeah, if you are getting an idea please let me know.
EDIT: EDIT: it would be nice to get the results every "tick" i think its every second the sudo intel_gpu_top updates itself but i could be wrong