Changeset 46639 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jun 18, 2013 5:33:09 PM (12 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r46616 r46639 732 732 generic/uuid-generic.cpp \ 733 733 generic/RTMpGetCoreCount-generic.cpp \ 734 generic/RTMpGetOnlineCoreCount-generic.cpp \ 734 735 generic/RTMpGetCurFrequency-generic.cpp \ 735 736 generic/RTMpGetMaxFrequency-generic.cpp \ … … 793 794 generic/mppresent-generic.cpp \ 794 795 generic/RTMpGetCoreCount-generic.cpp \ 796 generic/RTMpGetOnlineCoreCount-generic.cpp \ 795 797 generic/RTSemEventMultiWait-2-ex-generic.cpp \ 796 798 generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \ … … 867 869 generic/RTMpCpuId-generic.cpp \ 868 870 generic/RTMpGetCoreCount-generic.cpp \ 871 generic/RTMpGetOnlineCoreCount-generic.cpp \ 869 872 generic/RTProcDaemonize-generic.cpp \ 870 873 generic/RTProcIsRunningByName-generic.cpp \ … … 929 932 generic/RTUuidCreate-generic.cpp \ 930 933 generic/RTMpGetCoreCount-generic.cpp \ 934 generic/RTMpGetOnlineCoreCount-generic.cpp \ 931 935 generic/sched-generic.cpp \ 932 936 generic/utf16locale-generic.cpp \ … … 1007 1011 generic/RTThreadGetNativeState-generic.cpp \ 1008 1012 generic/RTMpGetCoreCount-generic.cpp \ 1013 generic/RTMpGetOnlineCoreCount-generic.cpp \ 1009 1014 r3/haiku/rtProcInitExePath-haiku.cpp \ 1010 1015 r3/haiku/time-haiku.cpp \ -
trunk/src/VBox/Runtime/generic/RTMpGetCoreCount-generic.cpp
r46146 r46639 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <internal/iprt.h>32 #include "internal/iprt.h" 33 33 34 34 … … 38 38 } 39 39 RT_EXPORT_SYMBOL(RTMpGetCoreCount); 40 -
trunk/src/VBox/Runtime/generic/RTMpGetOnlineCoreCount-generic.cpp
r46626 r46639 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <internal/iprt.h>32 #include "internal/iprt.h" 33 33 34 34 35 RTDECL(RTCPUID) RTMpGet CoreCount(void)35 RTDECL(RTCPUID) RTMpGetOnlineCoreCount(void) 36 36 { 37 return RTMpGet Count();37 return RTMpGetOnlineCount(); 38 38 } 39 RT_EXPORT_SYMBOL(RTMpGetCoreCount); 39 RT_EXPORT_SYMBOL(RTMpGetOnlineCoreCount); 40 -
trunk/src/VBox/Runtime/generic/mppresent-generic.cpp
r44529 r46639 47 47 48 48 49 RTDECL(RTCPUID) RTMpGetPresentCoreCount(void) 50 { 51 return RTMpGetCoreCount(); 52 } 53 RT_EXPORT_SYMBOL(RTMpGetPresentCoreCount); 54 55 49 56 RTDECL(bool) RTMpIsCpuPresent(RTCPUID idCpu) 50 57 { -
trunk/src/VBox/Runtime/r3/linux/mp-linux.cpp
r46326 r46639 34 34 35 35 #include <iprt/mp.h> 36 #include "internal/iprt.h" 37 38 #include <iprt/alloca.h> 36 39 #include <iprt/cpuset.h> 37 40 #include <iprt/assert.h> … … 180 183 RTDECL(RTCPUID) RTMpGetCoreCount(void) 181 184 { 182 RTCPUID cMax = rtMpLinuxMaxCpus(); 183 uint32_t aCores[256]; 184 RT_ZERO(aCores); 185 uint32_t cCores = 0; 185 RTCPUID cMax = rtMpLinuxMaxCpus(); 186 uint32_t *paidCores = (uint32_t *)alloca(sizeof(*uint32_t) * (cMax + 1)); 187 uint32_t cCores = 0; 186 188 for (RTCPUID idCpu = 0; idCpu < cMax; idCpu++) 187 189 { 188 190 if (RTMpIsCpuPossible(idCpu)) 189 191 { 190 uint32_t idCore = 191 (uint32_t)RTLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/topology/core_id", (int)idCpu); 192 unsigned i; 192 uint32_t idCore = (uint32_t)RTLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/topology/core_id", (int)idCpu); 193 uint32_t i; 193 194 for (i = 0; i < cCores; i++) 194 if ( aCores[i] == idCore)195 if (paidCores[i] == idCore) 195 196 break; 196 if ( i >= cCores 197 && cCores < RT_ELEMENTS(aCores)) 198 { 199 aCores[cCores] = idCore; 200 cCores++; 201 } 202 } 203 } 197 if (i >= cCores) 198 paidCores[cCores++] = idCore; 199 } 200 } 201 Assert(cCores > 0); 204 202 return cCores; 205 203 } … … 223 221 return RTCpuSetCount(&Set); 224 222 } 223 224 225 RTDECL(RTCPUID) RTMpGetOnlineCoreCount(void) 226 { 227 RTCPUID cMax = rtMpLinuxMaxCpus(); 228 uint32_t *paidCores = (uint32_t *)alloca(sizeof(*uint32_t) * (cMax + 1)); 229 uint32_t cCores = 0; 230 for (RTCPUID idCpu = 0; idCpu < cMax; idCpu++) 231 { 232 if (RTMpIsCpuOnline(idCpu)) 233 { 234 uint32_t idCore = (uint32_t)RTLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/topology/core_id", (int)idCpu); 235 uint32_t i; 236 for (i = 0; i < cCores; i++) 237 if (paidCores[i] == idCore) 238 break; 239 if (i >= cCores) 240 paidCores[cCores++] = idCore; 241 } 242 } 243 Assert(cCores > 0); 244 return cCores; 245 } 246 225 247 226 248 -
trunk/src/VBox/Runtime/r3/win/mp-win.cpp
r46637 r46639 166 166 } 167 167 168 169 RTDECL(RTCPUID) RTMpGetOnlineCoreCount(void) 170 { 171 /** @todo this isn't entirely correct. */ 172 return RTMpGetCoreCount(); 173 } 174
Note:
See TracChangeset
for help on using the changeset viewer.