安装
tsh@tsh-virtual-machine:~/codeTest/learnPerf$ perf stat ./test
The program 'perf' is currently not installed. You can install it by typing:
sudo apt install linux-tools-common
tsh@tsh-virtual-machine:~/codeTest/learnPerf$ sudo apt install linux-tools-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
linux-tools-common
0 upgraded, 1 newly installed, 0 to remove and 329 not upgraded.
Need to get 140 kB of archives.
After this operation, 565 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-tools-common all 4.4.0-142.168 [140 kB]
Fetched 140 kB in 5s (23.6 kB/s)
Selecting previously unselected package linux-tools-common.
(Reading database ... 182683 files and directories currently installed.)
Preparing to unpack .../linux-tools-common_4.4.0-142.168_all.deb ...
Unpacking linux-tools-common (4.4.0-142.168) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up linux-tools-common (4.4.0-142.168) ...
tsh@tsh-virtual-machine:~/codeTest/learnPerf$ sudo perf stat ./test
WARNING: perf not found for kernel 4.8.0-36
You may need to install the following packages for this specific kernel:
linux-tools-4.8.0-36-generic
linux-cloud-tools-4.8.0-36-generic
You may also want to install one of the following packages to keep up to date:
linux-tools-generic
linux-cloud-tools-generic
tsh@tsh-virtual-machine:~/codeTest/learnPerf$ sudo apt-get install linux-tools-4.8.0-36-generic linux-cloud-tools-4.8.0-36-generic linux-tools-generic