State of hardware performance monitoring in WSL2
@benhillis is already working on this.
Since Jun 8, 2022.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
I read mixed signals [1] [2] to which extent we can access the Performance Monitoring Unit by using the perf command. I cloned and compiled the perf tool present in https://github.com/microsoft/WSL2-Linux-Kernel and when I run sudo ./perf stat -d ls I get the following output:
Performance counter stats for 'ls':
1.76 msec task-clock # 0.730 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
108 page-faults # 0.061 M/sec
<not supported> cycles
<not supported> instructions
<not supported> branches
<not supported> branch-misses
<not supported> L1-dcache-loads
<not supported> L1-dcache-load-misses
<not supported> LLC-loads
<not supported> LLC-load-misses
0.002411486 seconds time elapsed
0.002558000 seconds user
0.000000000 seconds sys
Especially getting the cache misses would be interesting for my use case. Is it expected that measures like cycles, LLC-loads are "not supported" in WSL2 or did I do something wrong? If the former, is support for it planned?
[1] https://stackoverflow.com/questions/60237123/is-there-any-method-to-run-perf-under-wsl#comment125398632_60276918
[2] https://github.com/microsoft/WSL/issues/329#issuecomment-564461721
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.