Impossible to build on Windows due to Linux header used in cpucounters.h
Randomdude11 opened this issue · comments
I have been following the guide to run PCM on Windows, and I am at the building step where I invoke:
cmake --build build --config Release --parallel
However, this is hiving me a lot of errors related to the sys/syscall.h header -
fatal error: sys/syscall.h: No such file or directory
This is a Linux-specific header and there are multiple functions from this header being used which only work on Linux. Am I doing something wrong or is it actually impossible to build this on Windows? If so, I would suggest removing the Windows guide.
PCM is building on Windows in Appveyor: https://ci.appveyor.com/project/opcm/pcm
which version of MSVC are you using?
Hello,
Thanks for the quick reply. I was using MSVC 2022. After deleting the repo and pulling again, it seems to have been built successfully. Perhaps some old unsuccessful build was in the way.
When trying to start pcm.exe, my computer would crash with an "PCI_CONFIG_SPACE_ACCESS_FAILURE". I managed to fix that by disabling Virtualization-based Security - I had to turn off Virtual Machine Platform from windows features to do that (note that WSL will no longer work after this step). Now it seems to be running correctly.
However, I only see generalized stats for my CPU. I wanted to measure cache misses for a specific program. I see that it's possible to incorporate it in code and measure code snippets, however that requires the cpucounters.h header, which, as mentioned, contains the sys/syscall.h header, which is linux-specific.
Is there a way to measure only certain programs or C functions in Windows?
Thanks!
After looking into the source code, it seems it is only configured to run with MSVS, I was trying to use the counters in VSCode. I am trying to run it in Visual Studio and even though I am including the cpucounters.h header, I still cannot access the PCM class. Trying to debug...
Is there a way to measure only certain programs or C functions in Windows?
unfortunately, no. This requires OS API support to program and context-switch PMU registers. I am not aware of such on Windows.
please re-open if you still see the issue.