-
Notifications
You must be signed in to change notification settings - Fork 0
Obtaining perf
OptiWISE uses the Linux tool perf in the optiwise sample subcommand. Notably, the version of perf must match your Linux kernel version for it to work, so obtaining the right version is an important step.
On Ubunutu many versions of perf are available in different apt packages. Unfortunately, most of them will not be the same version as the Linux kernel, and thus won't work. We suggest running:
$ apt list --installed | grep 'linux-generic'which will produce output such as linux-generic/jammy-updates... or linux-generic-hwe-20.04/focal-updates... or linux-generic-hwe-22.04/jammy-updates.... The package that contains the correct version of perf is the correspondingly named linux-tools package, for example linux-tools-generic, linux-tools-generic-hwe-20.04, linux-tools-generic-hwe-22.04.
apt list --installed | grep 'linux-generic' |
perf install command |
|---|---|
linux-generic/... |
sudo apt install linux-tools-generic |
linux-generic-hwe-20.04/... |
sudo apt install linux-tools-generic-hwe-20.04 |
linux-generic-hwe-22.04/... |
sudo apt install linux-tools-generic-hwe-22.04 |
You can test if you have the right version by simply invoking perf. If it's wrong the output will look something like:
WARNING: perf not found for kernel 6.2.0-37
whereas if it is correct the output should be
usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
If you've installed the correct package but are still having difficulties, it's worth trying to restart your computer as the Linux kernel version may have recently updated, but the update will not apply until the next restart, meaning the version of perf will not match the kernel version.