Check CPU usage in Linux with XFreq
XFreq is an awesome tool to check CPU usage in Linux for Intel CPUs, offers both CLI and GUI interface, xfreq-gui and xfreq-cli respectively.
This is exclusively for Intel CPU’s, covers current Intel 6th generation Skylake CPU series as well as old Core 2 series. The GUI shows different widgets, covering various CPU related information like CPU frequency, CPU load, temperature, Turbo Boost and others.
The XFreq follows a client-server model to check CPU usage in Linux/UNIX, first start the XFreq server as root then check CPU usage with the previous tools as normal user.
Install XFreq in GNU/Linux
Though this software is around us since January of 2014, but not available in the software repository of any GNU/Linux distribution, so we have to compile it from source.
I’m using Debian Testing for compilation, the procedure is exactly same for any other Debian based distros like Ubuntu, Linux Mint. For other distros, just modify the package install commands.
1 . Install necessary softwares to compile XFreq,
sudo apt-get install git build-essential libc6-dev libx11-dev
2 . Get the latest source code from this github repo
cd ~/ git clone https://github.com/cyring/xfreq.git
3 . Compile XFreq
cd xfreq/ make -j2
That’s all building complete, there is no default install rule, till now, you can install it wherever you like, I’m copying the binaries to /usr/local/bin/ for easier access.
cd ~/xfreq sudo cp svr/bin/xfreq-intel /usr/local/bin/ sudo cp gui/bin/xfreq-gui /usr/local/bin/ sudo cp cli/bin/xfreq-cli /usr/local/bin/
You could also strip the binaries to make them smaller in size.
sudo strip -s /usr/local/bin/xfreq-*
XFreq, check CPU usage in Linux
First load some kernel modules, so the server part could collect the necessary data,
sudo modprobe msr sudo modprobe dmi-sysfs # optional
XFreq-intel is the server part, before starting the server, let’s have a look at few available server configuration options.
- -h Print the help messages
- -A Print out the built-in CPU architectures
- -c Pick up an architecture, an integer, from the previous command.
- -B Enable SmBIOS , 1 enable, 0 disable
- -S Set clock source, look at the -S option in help meaasge
Just starting the server may show incorrect results, I’ve to use those extra options too, look at the command bellow.
sudo xfreq-intel -S 1 -B 1 -c 26
Open up another terminal window/tab and run the xfreq-cli or xfreq-gui application, this time no root privilege required
Now the CLI part, nothing fancy here, just start the server with proper options as root and run xfreq-cli in another terminal tab. This should look like bellow.
Average C-states Turbo C0 C1 C3 C6 C7 40.90% 5.44% 6.34% 0.16 0.00% 88.05% CPU# F=1333.00 x R Temp IPS IPC CPI Task scheduling 0 696.40 0.52 42 0.00 0.06 17.25 ( 0) 1 187.64 0.14 42 0.01 0.33 3.00 ( 0) 2 374.17 0.28 47 0.00 0.05 18.21 ( 0) 3 1418.57 1.06 47 0.01 0.10 9.86 ( 0)
Credits and conclusion
Special thanks to the developer,
XFreq also runs on FreeBSD, and I’ll say it’s a great tool as CPU usage monitor and also to know various CPU related info, extremely helpful for beginners, the downside is XFreq supports only Intel CPUs.
Do you have any question or suggestion ? Just drop a comment, I’ll be happy to talk about it.