Changeset 11810 in vbox
- Timestamp:
- Aug 29, 2008 11:52:39 AM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r11689 r11810 95 95 int CollectorHAL::getHostCpuMHz(ULONG *mhz) 96 96 { 97 #if 1 /** @todo r=bird: this isn't taking offline cpus and gaps into account. The result may be way too low. Suggestion in the disabled #else case. */98 RTCPUID nProcessors = RTMpGetCount();99 100 if (nProcessors == 0)101 return VERR_NOT_IMPLEMENTED;102 103 uint64_t uTotalMHz = 0;104 105 for (RTCPUID i = 0; i < nProcessors; ++i)106 uTotalMHz += RTMpGetCurFrequency(RTMpCpuIdFromSetIndex(i));107 108 *mhz = (ULONG)(uTotalMHz / nProcessors);109 110 #else111 97 unsigned cCpus = 0; 112 98 uint64_t u64TotalMHz = 0; … … 114 100 RTMpGetOnlineSet(&OnlineSet); 115 101 for (RTCPUID iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) 116 Log4(("{%p} " LOG_FN_FMT ": Checking if CPU %d is member of online set...\n", 102 { 103 LogAleksey(("{%p} " LOG_FN_FMT ": Checking if CPU %d is member of online set...\n", 117 104 this, __PRETTY_FUNCTION__, (int)iCpu)); 118 105 if (RTCpuSetIsMemberByIndex(&OnlineSet, iCpu)) 119 106 { 120 Log 4(("{%p} " LOG_FN_FMT ": Getting frequency for CPU %d...\n",107 LogAleksey(("{%p} " LOG_FN_FMT ": Getting frequency for CPU %d...\n", 121 108 this, __PRETTY_FUNCTION__, (int)iCpu)); 122 109 uint32_t uMHz = RTMpGetCurFrequency(RTMpCpuIdFromSetIndex(iCpu)); 123 110 if (uMHz != 0) 124 111 { 125 Log 4(("{%p} " LOG_FN_FMT ": CPU %d %u MHz\n",112 LogAleksey(("{%p} " LOG_FN_FMT ": CPU %d %u MHz\n", 126 113 this, __PRETTY_FUNCTION__, (int)iCpu, uMHz)); 127 114 u64TotalMHz += uMHz; … … 129 116 } 130 117 } 118 } 131 119 132 120 AssertReturn(cCpus, VERR_NOT_IMPLEMENTED); 133 121 *mhz = (ULONG)(u64TotalMHz / cCpus); 134 #endif135 122 136 123 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/r3/darwin/mp-darwin.cpp
r11708 r11810 42 42 #include <sys/fcntl.h> 43 43 #include <errno.h> 44 #include <mach/mach.h> 44 45 45 46 #include <iprt/mp.h> … … 91 92 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 92 93 { 93 #if 194 #if 0 94 95 return RTMpIsCpuPossible(idCpu); 95 96 #else 96 97 /** @todo proper ring-3 support on darwin, see #3014. */ 98 natural_t nCpus; 99 processor_basic_info_t pinfo; 100 mach_msg_type_number_t count; 101 kern_return_t krc = host_processor_info(mach_host_self(), 102 PROCESSOR_BASIC_INFO, &nCpus, (processor_info_array_t*)&pinfo, &count); 103 AssertReturn (krc == KERN_SUCCESS, true); 104 bool isOnline = idCpu < nCpus ? pinfo[idCpu].running : true; 105 vm_deallocate(mach_task_self(), (vm_address_t)pinfo, count * sizeof(*pinfo)); 106 return isOnline; 97 107 #endif 98 108 } … … 131 141 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 132 142 { 133 #if 1143 #if 0 134 144 return RTMpGetSet(pSet); 135 145 #else
Note:
See TracChangeset
for help on using the changeset viewer.