B.2.1 Installing perf on lab computers
Install PERF on Lab Linux Computers
- Download the Linux Kernel source tarball with
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.124.tar.xz Links to an external site.
-
Unzip the tarball with
tar -xvJf linux-4.4.124.tar.xz
- Enter the directory of the tool
cd linux-4.4.124/tools/perf
- Compile the program
make
- Check if the program is running
./perf test
- If everything works you should see an output similar to this. You can copy the binary file to other locations for your convenience.
1: vmlinux symtab matches kallsyms : FAILED!
2: detect openat syscall event : FAILED!
3: detect openat syscall event on all cpus : FAILED!
4: read samples using the mmap interface : FAILED!
5: parse events tests : FAILED!
6: Validate PERF_RECORD_* events & perf_sample fields : FAILED!
7: Test perf pmu format parsing : Ok
8: Test dso data read : Ok
9: Test dso data cache : Ok
10: Test dso data reopen : Ok
11: roundtrip evsel->name check : FAILED!
12: Check parsing of sched tracepoints fields : FAILED!
13: Generate and check syscalls:sys_enter_openat event fields: FAILED!
14: struct perf_event_attr setup : Ok
15: Test matching and linking multiple hists : Ok
16: Try 'import perf' in python, checking link problems : Ok
17: Test breakpoint overflow signal handler : Ok
18: Test breakpoint overflow sampling : Ok
19: Test number of exit event of a simple workload : Ok
20: Test software clock events have valid period values : Ok
21: Test object code reading : FAILED!
22: Test sample parsing : Ok
23: Test using a dummy software event to keep tracking : Skip
24: Test parsing with no sample_id_all bit set : Ok
25: Test filtering hist entries : Ok
26: Test mmap thread lookup : Ok
27: Test thread mg sharing : Ok
28: Test output sorting of hist entries : Ok
29: Test cumulation of child hist entries : Ok
30: Test tracking with sched_switch : Ok
31: Filter fds with revents mask in a fdarray : Ok
32: Add fd to a fdarray, making it autogrow : Ok
33: Test kmod_path__parse function : Ok
34: Test thread map : Ok
35: Test LLVM searching and compiling : Skip
36: Test topology in session :Cannot read kernel map
Ok
37: Test BPF filter : Skip
38: x86 rdpmc test : Ok
39: Test converting perf time to TSC : FAILED!
40: Test x86 instruction decoder - new instructions : Ok
41: Test intel cqm nmi context read : Skip
Install PERF on your own laptop
PERF, which is part of the Linux-tools package, is an infrastructure and suite of tools for collecting and analyzing performance data. You should install the version of PERF that matches the version of your Linux kernel.
Enter:
uname -a
to identify the kernel on your test platform. Then, enter:
sudo apt-get linux-tools-X.Y
to install PERF, replacing X and Y with the major and minor version numbers of the kernel.