-
Notifications
You must be signed in to change notification settings - Fork 20
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
Windows: Implement cpu_physical_cores
and cpu_cores
#145
base: main
Are you sure you want to change the base?
Conversation
You may get physical cores and logical cores ( threads ) at the same time with Because this method requires copying more data from the kernel, I'm not sure whether it's faster than your implementation. Just another idea. |
54c47b2
to
3660f9d
Compare
I added several alternative implementations Implementation Speeds:
Plugged in:
On Battery life:
When heavily throttled (used power plans to downclock CPU to 1.06 GHz to simulate a slow computer)
|
There's virtually no difference between some of the implementations and those of |
According to stackoverflow, WMI, registry and GetLogicalProcessorInformationEx are only reliable ways to get the number of cpu logical cores (threads) |
That does seem to be the case. I've made a commit that addresses it. I used the implementation here as the basis of my implementation of |
Hi, I'm making a tool that can benefit from this. |
I've got a Windows VM lying around but I'm a bit busy at the moment. If this works correctly, I don't have a problem accepting the PR. I would appreciate @uttarayan21's input on the state of this PR because he's much more knowledgeable on Windows than I am. |
@@ -295,11 +297,159 @@ impl GeneralReadout for WindowsGeneralReadout { | |||
} | |||
|
|||
fn cpu_physical_cores(&self) -> Result<usize, ReadoutError> { | |||
Err(ReadoutError::NotImplemented) | |||
// Source: https://github.com/AFLplusplus/LibAFL/blob/main/libafl/src/bolts/core_affinity.rs#L423 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404
Hello, I'm a contributor to https://github.com/lptstr/winfetch (you've talked to the maintainer in #112), and would like to start applying some of the experience I gained there to this project.
cpu_physical_cores
GetLogicalProcessorInformation
and uses the returned buffer to get the computer's number of CPU corescpu_cores
HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor
and counts the number of subkeys