- Timestamp:
- May 17, 2013 2:46:57 PM (12 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r46080 r46144 551 551 generic/RTDirSetTimes-generic.cpp \ 552 552 generic/RTFileExists-generic.cpp \ 553 generic/RTMpGetCoreCount-generic.cpp \ 553 554 generic/RTMpGetCurFrequency-generic.cpp \ 554 555 generic/RTMpGetMaxFrequency-generic.cpp \ … … 714 715 generic/utf16locale-generic.cpp \ 715 716 generic/uuid-generic.cpp \ 717 generic/RTMpGetCoreCount-generic.cpp \ 716 718 generic/RTMpGetCurFrequency-generic.cpp \ 717 719 generic/RTMpGetMaxFrequency-generic.cpp \ … … 773 775 generic/RTUuidCreate-generic.cpp \ 774 776 generic/mppresent-generic.cpp \ 777 generic/RTMpGetCoreCount-generic.cpp \ 775 778 generic/RTSemEventMultiWait-2-ex-generic.cpp \ 776 779 generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \ … … 845 848 generic/uuid-generic.cpp \ 846 849 generic/RTMpCpuId-generic.cpp \ 850 generic/RTMpGetCoreCount-generic.cpp \ 847 851 generic/RTProcDaemonize-generic.cpp \ 848 852 generic/RTProcIsRunningByName-generic.cpp \ … … 905 909 generic/RTTimerCreate-generic.cpp \ 906 910 generic/RTUuidCreate-generic.cpp \ 911 generic/RTMpGetCoreCount-generic.cpp \ 907 912 generic/sched-generic.cpp \ 908 913 generic/utf16locale-generic.cpp \ … … 981 986 generic/RTProcIsRunningByName-generic.cpp \ 982 987 generic/RTThreadGetNativeState-generic.cpp \ 988 generic/RTMpGetCoreCount-generic.cpp \ 983 989 r3/haiku/rtProcInitExePath-haiku.cpp \ 984 990 r3/haiku/time-haiku.cpp \ -
trunk/src/VBox/Runtime/r3/linux/mp-linux.cpp
r44528 r46144 178 178 179 179 180 RTDECL(RTCPUID) RTMpGetCoreCount(void) 181 { 182 RTCPUID cMax = rtMpLinuxMaxCpus(); 183 uint32_t aCores[256]; 184 RT_ZERO(aCores); 185 uint32_t cCores = 0; 186 for (RTCPUID idCpu = 0; idCpu < cMax; idCpu++) 187 { 188 if (RTMpIsCpuPossible(idCpu)) 189 { 190 uint32_t idCore = 191 (uint32_t)RTLinuxSysFsReadIntFile(0, "devices/system/cpu/cpu%d/topology/core_id", (int)idCpu); 192 unsigned i; 193 for (i = 0; i < cCores; i++) 194 if (aCores[i] == idCore) 195 break; 196 if ( i >= cCores 197 && cCores < RT_ELEMENTS(aCores)) 198 { 199 aCores[cCores] = idCore; 200 cCores++; 201 } 202 } 203 } 204 return cCores; 205 } 206 207 180 208 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 181 209 { -
trunk/src/VBox/Runtime/testcase/tstMp-1.cpp
r44529 r46144 60 60 } 61 61 62 RTCPUID cCoreCpus = RTMpGetCoreCount(); 63 if (cCoreCpus > 0) 64 RTPrintf("tstMp-1: RTMpGetCoreCount -> %d\n", (int)cCoreCpus); 65 else 66 { 67 RTPrintf("tstMp-1: FAILURE: RTMpGetCoreCount -> %d\n", (int)cCoreCpus); 68 g_cErrors++; 69 cCoreCpus = 1; 70 } 71 62 72 RTCPUSET Set; 63 73 PRTCPUSET pSet = RTMpGetSet(&Set);
Note:
See TracChangeset
for help on using the changeset viewer.