-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use logical core count #6014
Use logical core count #6014
Conversation
dc27d1d
to
e8ad375
Compare
e8ad375
to
4517ab4
Compare
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.
😅 Guess I didn't self-build on that big machine I borrowed to test this.
fyi @mfkl
@@ -1725,7 +1725,7 @@ internal static void GatherCommandLineSwitches(ArrayList commandLineArgs, Comman | |||
if (String.Equals(switchName, "m", StringComparison.OrdinalIgnoreCase) || | |||
String.Equals(switchName, "maxcpucount", StringComparison.OrdinalIgnoreCase)) | |||
{ | |||
int numberOfCpus = Environment.ProcessorCount; | |||
int numberOfCpus = NativeMethodsShared.GetLogicalCoreCount(); |
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.
int numberOfCpus = NativeMethodsShared.GetLogicalCoreCount(); | |
int numberOfCpus = Environment.ProcessorCount; |
The change wave won't apply otherwise. Which actually suggests that we should consider putting all of the logic here into NativeMethodsShared since it can be centralized.
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.
I moved the xmake logic instead: d5ac55a
I think this is the correct way to do it, didn't realize the thing can return -1 :)
Where can I get that many cores!? |
A test started failing after upgrading my machine to 18 cores:
So I changed all occurrences of Environment.ProcessorCount to NativeMethodsShared.GetLogicalCoreCount