-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will RR work in WSL 2 #2506
Comments
I didn't add this as a comment on #2118 because that was for WSL 1, which wasn't trying to allow tools like |
Hyper-V doesn't virtualize hardware performance counters as far as I know. If you run |
I don't see any This article seems to imply that Hyper-V does allow perf counters: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/performance-monitoring-hardware although WSL 2 VMs do not show up in the various |
Great, that's good news! You need to find a way to turn that on for WSL2. If you successfully turn it on you should see stuff like this in
Then you can try rr. There are many more reasons why rr might not work, some which we could fix and some we couldn't, but it's definitely not going to work until you get that |
I'm 99.9% sure that WSL's ptrace implementation is still not sufficient too. |
That's WSL1. WSL2 is real Linux so ptrace should be OK. |
The performance counters can't be unlocked via normal Hyper-V settings, but you can modify vmwp.exe. |
It will work in the Store version of WSL. |
Ah I see HW perf counters was shipped with 0.50.2 edit: It seems to work in WSL2 now. |
For those who are still experiencing a perf issue, just try |
@J-jaeyoung When I run [FATAL /home/ubuntu/rr/src/PerfCounters.cc:316:start_counter()] Unable to open performance counter with 'perf_event_open'; are hardware perf events available? See https://github.com/rr-debugger/rr/wiki/Will-rr-work-on-my-system When I follow the instructions in $ perf stat -e br_inst_retired.conditional true I encounter the following warning: WARNING: perf not found for kernel 5.15.146.1-microsoft
You may need to install the following packages for this specific kernel:
linux-tools-5.15.146.1-microsoft-standard-WSL2
linux-cloud-tools-5.15.146.1-microsoft-standard-WSL2
You may also want to install one of the following packages to keep up to date:
linux-tools-standard-WSL2
linux-cloud-tools-standard-WSL2 I tried to install the mentioned Microsoft packages using $ sudo apt install linux-tools-5.15.146.1-microsoft-standard-WSL2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-tools-5.15.146.1-microsoft-standard-WSL2
E: Couldn't find any package by glob 'linux-tools-5.15.146.1-microsoft-standard-WSL2' Have you encountered these issues before? |
@song-yuhang Try the following commands.
|
❯ perf stat -e br_inst_retired.conditional true
event syntax error: 'br_inst_retired.conditional'
\___ parser error
Run 'perf list' for a list of valid events
Usage: perf stat [<options>] [<command>]
-e, --event <event> event selector. use 'perf list' to list available events This is my result, after I did what @J-jaeyoung exactly mentioned. I ended up here. |
@vimkim The exact name depends on both the processor and the perf version - see https://github.com/rr-debugger/rr/wiki/Will-rr-work-on-my-system |
I want to try out RR on a project of mine, and the easiest way for me to try it out is through a WSL 2 Ubuntu VM on a Windows computer.
After downloading v5.3.0 using the instructions from the homepage:
And using it on an example binary:
I get the following error message:
Given the advice, I looked into how to use
perf record
on WSL 2. According to this issue: microsoft/WSL#329, it looks like all I need to do is build perf from source (which is thankfully very easy) and run it.Here's what I ran:
This command seems to run fine! I can view the trace with
perf report
and there were no error messages.So why is
perf_event_open
returning ENOENT to RR?Some of my build info in case any of that is relevant:
uname -sr
rr --version
EDIT: Tried on the newest Windows Insiders build as of 2020-04-13 (build number 19603), still no luck
The text was updated successfully, but these errors were encountered: