Sometimes you just want to see how hard the GPU is working. Enter the GPU Activity Monitor. Looky here:
Traditionally if you want to see how busy a Linux system is, you can use a graphical tool like System Monitor. The CPU, memory and networking and a wide variety of other good innards are on display. However, one thing that is missing is GPU utilization.
Most developers use the tegrastats tool to get a feel for GPU utilization, which reports as a percentage of maximum. This prints with a large number of other system parameters every second. For my particular use case, I am only interested in a graph of how the GPU is being utilized over time.
Simple Stupid Good
After fiddling around a little bit, I figured out how to get the GPU utilization and wrote a simple Python script to graph utilization against time. Similar to the way that System Monitor works, the graph shows utilization over a 60 second interval.
This is a dead simple implementation, rather brute force. It would have been nice if I knew Python, but hey! The Python script utilizes the Matplotlib library. You can use the script with Python 2 or Python 3.
The graph is implemented as an animated Python Matplotlib graph. The first step is to install the appropriate Matplotlib library.
For Python 2.7, Matplotlib may be installed as follows:
$ sudo apt-get install python-matplotlib
For Python 3, Matplotlib may be installed as follows:
$ sudo apt-get install python3-matplotlib
Next, on the JetsonHacks account on Github there is a repository named gpuGraphTX. Clone the repository
$ git clone https://github.com/jetsonhacks/gpuGraphTX
and switch over to the repository’s directory:
$ cd gpuGraphTX
The Fun Part, Run the Script
You can run the app:
$ python gpuGraph.py
$ python3 gpuGraph.py
After a little time spent loading fonts, the graph appears:
You can resize the window to get a better view of the activity, as well as use the toolbar to do actions like zoom in on any given section or save the graph to a file.
In the video, the script was installed on a Jetson TX2 directly after flashing L4T 28.2 using JetPack 3.2. The script has been tested with both the Jetson TX1 and Jetson TX2, and using Python 2.7 and Python 3.5.