summaryrefslogtreecommitdiff
path: root/src/pal/src/misc/sysinfo.cpp
diff options
context:
space:
mode:
authorTom Deseyn <tom.deseyn@gmail.com>2017-05-29 15:46:10 +0200
committerJan Vorlicek <janvorli@microsoft.com>2017-05-29 15:46:10 +0200
commitee454e11d0c73820dde10ab710f9d6eccd4471f1 (patch)
treecc18b73370f4ec65ae9fa9c34dd6a3ce65ea7f82 /src/pal/src/misc/sysinfo.cpp
parentc08d7df65036795bc3284e18624827303a097c88 (diff)
downloadcoreclr-ee454e11d0c73820dde10ab710f9d6eccd4471f1.tar.gz
coreclr-ee454e11d0c73820dde10ab710f9d6eccd4471f1.tar.bz2
coreclr-ee454e11d0c73820dde10ab710f9d6eccd4471f1.zip
Implement GetCurrentProcessCpuCount for Unix and merge NumberOfProcesors implementations. (#11742)
* Implement GetCurrentProcessCpuCount for Unix and merge NumberOfProcessors implementations. * Split GetCurrentProcessCpuCount in PAL and non-PAL parts * gcenv.unix.cpp: GetCurrentProcessAffinityMask: revert, GetCurrentProcessCpuCount: add implementation * bugfix: #if instead of #ifdef HAVE_SCHED_GETAFFINITY * Remove PAL_GetCurrentProcessCpuCount * gcenv.unix: implement GetCurrentProcessAffinityMask, GetCurrentProcessCpuCount * numa.cpp: initialize g_cpuToAffinity[i].Number when numa.h is missing * cleanup * mscorwks_unixexports.src: Add GetProcessAffinityMask * PR feedback * Add GetProcessAffinityMask to mscordac_unixexports.src
Diffstat (limited to 'src/pal/src/misc/sysinfo.cpp')
-rw-r--r--src/pal/src/misc/sysinfo.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp
index 70fe3e65d2..e1785688dc 100644
--- a/src/pal/src/misc/sysinfo.cpp
+++ b/src/pal/src/misc/sysinfo.cpp
@@ -94,13 +94,10 @@ SET_DEFAULT_DEBUG_CHANNEL(MISC);
#endif
#endif // __APPLE__
-/*++
-Function:
- GetNumberOfProcessors
-Return number of processors available for the current process
---*/
-int GetNumberOfProcessors()
+DWORD
+PALAPI
+PAL_GetLogicalCpuCountFromOS()
{
int nrcpus = 0;
@@ -170,7 +167,7 @@ GetSystemInfo(
lpSystemInfo->dwPageSize = pagesize;
lpSystemInfo->dwActiveProcessorMask_PAL_Undefined = 0;
- nrcpus = GetNumberOfProcessors();
+ nrcpus = PAL_GetLogicalCpuCountFromOS();
TRACE("dwNumberOfProcessors=%d\n", nrcpus);
lpSystemInfo->dwNumberOfProcessors = nrcpus;
@@ -387,19 +384,6 @@ PAL_HasGetCurrentProcessorNumber()
return HAVE_SCHED_GETCPU;
}
-DWORD
-PALAPI
-PAL_GetLogicalCpuCountFromOS()
-{
- DWORD numLogicalCores = 0;
-
-#if HAVE_SYSCONF
- numLogicalCores = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
-
- return numLogicalCores;
-}
-
size_t
PALAPI
PAL_GetLogicalProcessorCacheSizeFromOS()