如何安装“perf”监控工具?
如何安装perf
监控工具?
perf
实用程序可以在linux-tools包中找到。
在Ubuntu 14.04上,我必须安装三个软件包:
apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r`
确保您正在为正确的内核版本安装此工具。 如果你只输入:
sudo apt-get install linux-tools
它将为您机器中的最新Linux版本安装它,如果您正在启动以前的版本(例如出于稳定性原因),它将会出错。 在我的情况下,它安装.45而不是.43,我不得不使用以下命令来安装它:
sudo apt-get install linux-tools-3.2.0.43
您可以通过输入以下命令找到您的内核版本: uname -r
为了确保它正常工作,你可以试试这个: perf record /bin/ls
如果您要安装Zoom工具 ,则需要安装Perf才能使用其所有实用程序。
要获得最新版本的perf而不考虑内核版本(perf版本独立于内核版本):
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
来检查当前版本
在14.04, linux-tools
包不存在不合格:
$ 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 3.13.0.36.43 linux-tools-lowlatency 3.13.0.36.43 linux-tools-generic-lts-trusty 3.13.0.36.43 linux-tools-generic-lts-saucy 3.13.0.36.43 linux-tools-generic 3.13.0.36.43 You should explicitly select one to install. E: Package 'linux-tools' has no installation candidate
相反,您可以安装列出的其中一个软件包,具体取决于您安装的内核。 大多数用户都希望使用linux-tools-generic
。
我在我的机器上安装了Linux 3.17.2并尝试了
sudo apt-get install linux-tools-3.17.2
它表明linux-tools不存在。 在这种情况下,下载所需的linux内核版本,转到linux-> tools-> perf:
cd linux/tools/perf
然后运行make命令:
make
然后运行make install命令:
make install
然后重启。 你刚刚手动安装了perf。
运行以下两个命令就可以了!
sudo apt-get install linux-tools-common sudo apt-get install linux-tools
sudo apt-get install linux-tools-virtual