How do I install the
perf monitoring tool?
Make sure you are installing this tool for the right Kernel release. If you just type:
sudo apt-get install linux-tools
It will install it for the latest Linux release in your machine and in case you are booting a previous version (say for stability reason), it will err. In my case it installed for .45 instead of .43 and I had to use the following command to install it:
sudo apt-get install linux-tools-22.214.171.124
You can find your Kernel release by typing :
To make sure it's working right you can try this:
perf record /bin/ls
Just in case you are going to install Zoom tool, you need to have Perf installed for being able to use all its utilities.
To get the latest version of perf irrespective of the kernel version (perf version is independent of the kernel version):
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cd linux/tools/perf make cp perf /usr/bin
perf --version to check the current version
In 14.04, the
linux-tools package does not exist unqualified:
$ sudo apt-get install linux-tools Reading package lists... Done Building dependency tree Reading state information... Done Package linux-tools is a virtual package provided by: linux-tools-virtual 126.96.36.199.43 linux-tools-lowlatency 188.8.131.52.43 linux-tools-generic-lts-trusty 184.108.40.206.43 linux-tools-generic-lts-saucy 220.127.116.11.43 linux-tools-generic 18.104.22.168.43 You should explicitly select one to install. E: Package 'linux-tools' has no installation candidate
Instead, you can install one of the packages listed, depending upon the kernel you have installed. Most users will want
I installed Linux 3.17.2 on my machine and tried
sudo apt-get install linux-tools-3.17.2
it showed that linux-tools is not present. In this case, download the required linux kernel version, go to linux->tools->perf :
and then run make command :
and then run make install command:
and then reboot. You just installed perf manually.