Changeset 11591 in vbox
- Timestamp:
- Aug 23, 2008 4:28:29 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 35220
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r11583 r11591 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. */ 97 98 RTCPUID nProcessors = RTMpGetCount(); 98 99 … … 106 107 107 108 *mhz = (ULONG)(uTotalMHz / nProcessors); 109 110 #else 111 unsigned cCpus = 0; 112 uint64_t u64TotalMHz = 0; 113 RTCPUSET OnlineSet; 114 RTMpGetOnlineSet(&OnlineSet); 115 for (RTCPUID iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) 116 if (RTCpuSetIsMemberByIndex(&OnlineSet, iCpu)) 117 { 118 uint32_t uMHz = RTMpGetCurFrequency(RTMpCpuIdFromSetIndex(iCpu)); 119 if (uMHz != 0) 120 { 121 u64TotalMHz += uMHz; 122 cCpus++; 123 } 124 } 125 126 AssertReturn(cCpus, VERR_NOT_IMPLEMENTED); 127 *mhz = (ULONG)(u64TotalMHz / cCpus); 128 #endif 129 108 130 return VINF_SUCCESS; 109 131 } … … 116 138 { 117 139 mLastSampleTaken = nowAt; 118 Log4(("{%p} " LOG_FN_FMT ": Collecting %s for obj(%p)...\n", 140 Log4(("{%p} " LOG_FN_FMT ": Collecting %s for obj(%p)...\n", 119 141 this, __PRETTY_FUNCTION__, getName(), (void *)mObject)); 120 142 collect(); … … 178 200 mIdle->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * idleDiff / totalDiff)); 179 201 } 180 202 181 203 mUserPrev = user; 182 204 mKernelPrev = kernel; … … 260 282 mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processKernel - mProcessKernelPrev ) / (hostTotal - mHostTotalPrev))); 261 283 } 262 284 263 285 mHostTotalPrev = hostTotal; 264 286 mProcessUserPrev = processUser; … … 330 352 copyTo(data); 331 353 } 332 354 333 355 void Metric::query(ULONG **data, ULONG *count) 334 356 {
Note:
See TracChangeset
for help on using the changeset viewer.