How to get GPU Usage statistics
How to read tegrastats gpu utilisation values
What exactly does the GPU utilization from 'tegrastats' mean?
Source for tegrastats and/or info about querying overall GPU utilization?
Hi everyone, I've been playing around with a Jetson Nano at work and really enjoying its performance. I recently discovered that it works with the Raspberry Pi POE hat (hooray, less cable management).
Anyway, I'm currently searching for a tool that can give me the output of tegrastats/jetson-stats (e.g. things like CPU/GPU usage and temperature, power draw, etc.) in a CSV format so I can chart the data. Any solutions out there, or suggestions on how I can maybe program something to get this?
This can be done easily in one line:
echo "RAM,SWAP" > stats.csv && tegrastats | while read a; do echo "$a" | awk -F "[/ ]" '{OFS=","}{print $2,$7}' >> stats.csv; done
will stream RAM and SWAP usage to a comma-delimited CSV file named stats.csv with column headers in the first row structured like this:
RAM,SWAP
2209,100
2214,100
2214,100
2214,100
2214,100
2214,100
2214,100
You can adapt this easily to your needs by adding additional column headers in the echo part and extracting said columns in the print part.
A little explanation:
- The $2 in the print part extracts the second column from tegrastats
- The -F "[/ ]" makes sure to segment the output by spaces and forward-slashes
- The while read loop is for unbuffering the output from tegrastats
- To follow the transformation execute the first row in this post in one terminal, open another terminal and enter tail -f stats.csv (in the same directory) to see the output streaming into the stats.csv file
Cheers
Maybe `tegratop`
https://github.com/pythops/tegratop