This is a very short post with instructions on how to install perf
on Ubunutu 20.04 LTS in Oracle Cloud Infrastructure (OCI). I created my VM using the Canonical-Ubuntu-20.04-Minimal-2021.06.14-0 image.
Updating the image first
The first thing I do with each image I spin up in the cloud is to update all the packages. By the way, you log into ubuntu using the ubuntu account (not opc):
$ ssh ubuntu@1.2.3.3 Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.8.0-1034-oracle x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage This system has been minimized by removing packages and content that are not required on a system that users do not log into. To restore this content, you can run the 'unminimize' command. 0 updates can be applied immediately. Last login: Tue Jul 13 19:52:40 2021 from 1.2.3.2
The command to update all packages in Ubuntu is a one-liner:
$ sudo apt-get update && sudo apt-get dist-upgrade -y
In many cases a new kernel is installed as part of that exercise, mandating a reboot.
Installing perf
The current kernel at the time of writing was 5.8.0-1034-oracle. It’s nice to see that Oracle chose the HWE kernel (eg 5.8x.) over the GA kernel (5.4.x).
I used the following command to install perf
on the VM:
$ sudo apt-get install linux-tools-$(uname -r) linux-tools-generic Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libdw1 libnuma1 libpci3 libslang2 libunwind8 linux-oracle-5.8-tools-5.8.0-1034 linux-tools-5.4.0-77 linux-tools-5.4.0-77-generic linux-tools-common pci.ids The following NEW packages will be installed: libdw1 libnuma1 libpci3 libslang2 libunwind8 linux-oracle-5.8-tools-5.8.0-1034 linux-tools-5.4.0-77 linux-tools-5.4.0-77-generic linux-tools-5.8.0-1034-oracle linux-tools-common linux-tools-generic pci.ids 0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. Need to get 12.9 MB of archives. After this operation, 59.3 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://eu-frankfurt-1-ad-3.clouds.archive.ubuntu.com/ubuntu focal/main amd64 libslang2 amd64 2.3.2-4 [429 kB] ...
Once the installation is complete I can use perf
as usual:
$ perf --version perf version 5.8.18
Tracepoints!
A quick check of static tracepoints reveals plenty in 5.8.0-1034-oracle:
$ sudo perf list tracepoint | \ > awk -F: '{ a[$1]++ } END { for (i in a) print i, a[i]}' | \ > column syscalls 670 sync_trace 1 interconnect 2 scsi 5 rcu 1 skb 3 io_uring 14 i2c 4 nmi 1 exceptions 2 rseq 2 msr 3 qdisc 4 mmc 2 xen 27 drm 3 erofs 9 jbd2 17 mce 1 tlb 1 napi 1 libata 6 x86_fpu 11 clk 16 block 18 pwm 2 fib 1 rpm 5 power 22 workqueue 4 xdp 12 page_pool 4 tcp 7 iocost 5 timer 13 cpuhp 3 thermal 5 initcall 3 filelock 12 rtc 12 printk 1 smbus 4 cros_ec 2 intel_iommu 7 pagemap 2 writeback 34 alarmtimer 4 compaction 14 gpio 2 hwmon 3 sched 24 iomap 8 regmap 15 mdio 1 devlink 5 btrfs 79 bpf_test_run 1 sunrpc 109 udp 1 irq_vectors 34 neigh 7 net 18 vmscan 18 irq 5 regulator 11 irq_matrix 12 devfreq 1 random 15 page_isolation 1 hyperv 5 task 2 ftrace 2 percpu 5 huge_memory 4 wbt 4 migrate 1 raw_syscalls 2 iscsi 7 thermal_power_allocator 2 mmap 1 fs_dax 14 ras 6 iommu 7 oom 8 sock 3 fib6 1 signal 2 vsyscall 1 swiotlb 1 kmem 13 bridge 4 cgroup 13 filemap 4 spi 7 module 5 resctrl 3 xhci-hcd 53 ext4 105 dma_fence 7
I’ll do a few more tests later, but for now it seems I’m set and ready to go. Should you find problems I’m happy to update the post so please let me know!