Is there any method to run perf under WSL?
WARNING: perf not found for kernel 4.19.84-microsoft
Because WSL2 uses custom Linux kernel. Its source code can be found here
microsoft/WSL2-Linux-Kernel. We have to compile perf tools from it.
Procedure
- Install required build packages. If you are using Ubuntu in WSL2 this is the
required command:
sudo apt install build-essential flex bison libssl-dev libelf-dev
- Clone the WSL2 Linux kernel repository:
git clone --depth=1 https://github.com/microsoft/WSL2-Linux-Kernel.git
- Go to perf folder and compile it:
cd WSL2-Linux-Kernel/tools/perf
make
perf
executable file will be in that folder.
Cannot run .exe when under /home but can when under /mnt/c
Create /etc/wsl.conf
and define the following inside it:
[automount]
enabled = true
options = "metadata,uid=1000,gid=1000,umask=0022,fmask=11,case=off"
mountFsTab = false
crossDistro = true
[network]
generateHosts = true
generateResolvConf = true
[filesystem]
umask = 0022
[interop]
enabled = true
appendWindowsPath = true
The interop section explicitly enabling it to true might resolve the issue. Be sure to also keep in mind if you run WSL2 and also use the systemd hack, your Windows interop will break and no exe files will be able to be executed.
Related Topics
Add Blank Line Between Lines from Different Groups
Overwrite Input File Using Awk
How to Get Out of 'Screen' Without Typing 'Exit'
Find the Files Existing in One Directory But Not in the Other
Rename Files and Directories (Add Prefix)
Backing Up (And Restoring) a Plone Instance
Unable to Pass Wget a Variable with Quotes Inside the Variable
Printing Variable to Command Line Using Assembly in Linux
How to Wrap Lines Within Columns in Linux
Is Kernel Space Mapped into User Space on Linux X86
Why Didn't I Get Segmentation Fault When Storing Past the End of the Bss
Explicitly Invoke Sig_Dfl/Sig_Ign Handlers on Linux
Installed Go Binary Not Found in Path on Alpine Linux Docker
Bash: Best Architecture for Reading from Two Input Streams