Skip to content

JHenneberg/perf_WSL2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

perf_WSL2

How to run perf on WSL2

This is heavily based on the comment of MondayCha.

Tested with

wsl2 Linux Kernel Distribution is_working?
5.15.90.1-microsoft-standard-WSL2 x86_64 Ubuntu-22.04 [x]
5.15.90.1-microsoft-standard-WSL2 x86_64 Ubuntu-20.04 [x]

tl;dr

Windows

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --update
wsl --install -d Ubuntu-22.04

WSL2

sudo apt update
sudo apt upgrade
sudo apt install flex bison 
sudo apt install libdwarf-dev libelf-dev libnuma-dev libunwind-dev \
libnewt-dev libdwarf++0 libelf++0 libdw-dev libbfb0-dev \
systemtap-sdt-dev libssl-dev libperl-dev python-dev-is-python3 \
binutils-dev libiberty-dev libzstd-dev libcap-dev libbabeltrace-dev \
make
git clone https://github.com/microsoft/WSL2-Linux-Kernel --depth 1
cd WSL2-Linux-Kernel/tools/perf
make
sudo cp perf /usr/local/bin

More

Windows

More Info

  • activate WSL and virtual machine functions

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • update WSL

    wsl --update
    wsl --install -d Ubuntu-22.04
  • install linux distribution (wsl --list --online shows all available distributions)

    wsl --install -d Ubuntu-22.04

WSL2

  • Update and Upgrade

    update rereads all package sources, while upgrade brings the installed packages up to the latest available in the package sources.

    sudo apt update
    sudo apt upgrade
  • Installing packages to build perf

    sudo apt install flex bison 
    sudo apt install libdwarf-dev libelf-dev libnuma-dev libunwind-dev \
    libnewt-dev libdwarf++0 libelf++0 libdw-dev libbfb0-dev \
    systemtap-sdt-dev libssl-dev libperl-dev python-dev-is-python3 \
    binutils-dev libiberty-dev libzstd-dev libcap-dev libbabeltrace-dev \
    make
  • clone WSL2-Linux-Kernel sources

    git clone https://github.com/microsoft/WSL2-Linux-Kernel --depth 1
  • set current directory to WSL2-Linux-Kernel/tools/perf

    cd WSL2-Linux-Kernel/tools/perf
  • build perf from sources

    make
  • copy sources to /usr/local/bin

    sudo cp perf /usr/local/bin

About

How to run `perf` on WSL2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published