Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac (#24777)
authorAndy Hanson <anhans@microsoft.com>
Wed, 5 Jun 2019 23:58:56 +0000 (16:58 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2019 23:58:56 +0000 (16:58 -0700)
commit5d4ff2f11a87d7d434d05e72744946f48e017b11
tree4b888de6cf6716f34e93fc40e0c0bcf352b94122
parent10df20ed3ff0208b3f16f79d5062662a8827f579
Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac (#24777)

* Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac

In a previous PR
(https://github.com/dotnet/coreclr/commit/ed52a006c01a582d4d34add40c318d6f324b99ba#diff-8447e54277bb962d167a77bb260760d7R1879),
GetCacheSizePerLogicalCpu was changed to no longer rely on cpuid on
amd64 systems; instead it uses GetLogicalProcessorCacheSizeFromOS().
Unfortunately that function consisted of a number of `#if`s, none of
which were active on macs, and we just returned 0. This caused us to
default to a gen0size of only 0.25MB, causing many GCs.

Fixed by adding a new case that uses `sysctlbyname`.

Fix #24658

* Fixes from code review

* Check for function sysctlbyname instead of header
src/pal/src/config.h.in
src/pal/src/configure.cmake
src/pal/src/misc/sysinfo.cpp