IN-DEPTH Sensors and sensibility
SENSORS AND SENSIBILIT Y
Recalling a past life where he gazed on dials and Galilean thermometers, Jonni Bidwell assesses Linux’s system monitoring offerings.
W e don’t think that governments or tech giants have good reason to be monitoring every aspect of our lives. But we do think it’s well within your remit to monitor all the minutia of your Linux machine.
CPU load, fan speeds, temperatures, network traffic and disk space are just some of the things that you can keep an eye on. And when it’s presented in delightful graph form it’s a pleasure to do so.
There’s good reason to keep an eye on this data. If you notice your machine slowing down it could be because it’s run out of memory, or because a task is hogging the CPU. These are easy to check for from the command line or from a graphical system monitor. But the culprit could be overheating, which you could check for by prodding the heatsinks on your CPU and graphics card, but we don’t recommend that. Instead, we’ll show you how to read thermal information from the command line and even capture it while you’re playing your favourite GPU-intensive shooting game and then graph it with Gnuplot.
Modern graphics cards have all kinds of sensors on them and Windows users have long enjoyed friendly GUI applications to monitor and meddle with voltages and frequencies. The open source AMDGPU driver avails the kernel of all this data, and Nvidia’s System Management Interface (SMI) enables users of such hardware do so from the command line. But for AMD users there’s the superb CoreCtrl, which can monitor everything in real time. Not only that, you can use it to fine-tune your GPU settings for maximum performance or optimal power efficiency.
T here are a few command line tools everyone should know about, and one of them is Top. It comes free with any Linux distro you’d care to name. Open up a terminal and type top to see a list of running processes ordered by CPU usage, updated every couple of seconds.
The first line shows system uptime and load information (the last three numbers are how busy your CPU has been over the last one, five and 15 minutes). The next line shows how CPU time has been spent on system and user tasks, and how long it has been idle. Next we see how long it has been waiting on I/O operations and servicing hardware interrupts. The MiB Mem row shows memory and swap space usage. Free memory is essentially wasted memory, so programs will use as much as they can for buffers and cache, which you’ll see in the last column. This isn’t really hogging memory, since it can be readily relinquished. So if it makes you feel better you can add this figure to the free memory displayed.