Skip to content
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

Impossible to build on Windows due to Linux header used in cpucounters.h #740

Open
Randomdude11 opened this issue May 6, 2024 · 4 comments

Comments

@Randomdude11
Copy link

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.

@opcm
Copy link
Contributor

opcm commented May 6, 2024

PCM is building on Windows in Appveyor: https://ci.appveyor.com/project/opcm/pcm

which version of MSVC are you using?

@Randomdude11
Copy link
Author

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!

@Randomdude11
Copy link
Author

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...

@opcm
Copy link
Contributor

opcm commented May 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants