Changeset 27930 in vbox for trunk/src/VBox/Main/Performance.cpp
- Timestamp:
- Apr 1, 2010 11:07:21 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r27885 r27930 135 135 if (ASMAtomicIncU32(&cEnabled) == 1) 136 136 { 137 #if 0138 137 ComPtr<IInternalSessionControl> directControl; 139 138 … … 142 141 return ret; 143 142 144 /* get the associated console */ 145 ComPtr<IConsole> console; 146 ret = directControl->COMGETTER(Console)(console.asOutParam())); 143 /* get the associated console; this is a remote call (!) */ 144 ret = directControl->GetRemoteConsole(mConsole.asOutParam()); 147 145 if (ret != S_OK) 148 146 return ret; 149 147 150 ComPtr<IGuest> guest; 151 ret = console->COMGETTER(Guest)(guest.asOutParam()); 148 ret = mConsole->COMGETTER(Guest)(mGuest.asOutParam()); 152 149 if (ret == S_OK) 153 { 154 } 155 #endif 150 mGuest->COMSETTER(StatisticsUpdateInterval)(1000 /* 1000 ms */); 156 151 } 157 152 return ret; … … 162 157 if (ASMAtomicDecU32(&cEnabled) == 0) 163 158 { 159 Assert(mGuest && mConsole); 160 mGuest->COMSETTER(StatisticsUpdateInterval)(0 /* off */); 164 161 } 165 162 return S_OK; 166 163 } 164 165 int CollectorGuestHAL::preCollect(const CollectorHints& hints, uint64_t iTick) 166 { 167 if ( mGuest 168 && iTick != mLastTick) 169 { 170 mGuest->InternalGetStatistics(0, &mCpuUser, &mCpuKernel, &mCpuIdle, 171 &mMemTotal, &mMemFree, &mMemBalloon, &mMemCache, 172 &mPageTotal, &mPageFree); 173 mLastTick = iTick; 174 } 175 return S_OK; 176 } 177 167 178 #endif /* VBOX_COLLECTOR_TEST_CASE */ 168 179 … … 209 220 } 210 221 211 void HostCpuLoadRaw::preCollect(CollectorHints& hints )222 void HostCpuLoadRaw::preCollect(CollectorHints& hints, uint64_t iTick) 212 223 { 213 224 hints.collectHostCpuLoad(); … … 273 284 } 274 285 275 void HostRamUsage::preCollect(CollectorHints& hints )286 void HostRamUsage::preCollect(CollectorHints& hints, uint64_t iTick) 276 287 { 277 288 hints.collectHostRamUsage(); … … 311 322 } 312 323 313 void MachineCpuLoadRaw::preCollect(CollectorHints& hints )324 void MachineCpuLoadRaw::preCollect(CollectorHints& hints, uint64_t iTick) 314 325 { 315 326 hints.collectProcessCpuLoad(mProcess); … … 348 359 } 349 360 350 void MachineRamUsage::preCollect(CollectorHints& hints )361 void MachineRamUsage::preCollect(CollectorHints& hints, uint64_t iTick) 351 362 { 352 363 hints.collectProcessRamUsage(mProcess); … … 372 383 } 373 384 374 void GuestCpuLoad::preCollect(CollectorHints& /* hints */) 375 { 385 void GuestCpuLoad::preCollect(CollectorHints& hints, uint64_t iTick) 386 { 387 mHAL->preCollect(hints, iTick); 376 388 } 377 389 378 390 void GuestCpuLoad::collect() 379 391 { 380 #if 0 381 uint64_t processUser, processKernel, hostTotal; 382 383 int rc = mHAL->getRawProcessCpuLoad(mProcess, &processUser, &processKernel, &hostTotal); 384 if (RT_SUCCESS(rc)) 385 { 386 if (hostTotal == mHostTotalPrev) 387 { 388 /* Nearly impossible, but... */ 389 mUser->put(0); 390 mKernel->put(0); 391 } 392 else 393 { 394 mUser->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processUser - mProcessUserPrev) / (hostTotal - mHostTotalPrev))); 395 mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processKernel - mProcessKernelPrev ) / (hostTotal - mHostTotalPrev))); 396 } 397 398 mHostTotalPrev = hostTotal; 399 mProcessUserPrev = processUser; 400 mProcessKernelPrev = processKernel; 401 } 402 #endif 392 ULONG CpuUser = 0, CpuKernel = 0, CpuIdle = 0; 393 394 mGuestHAL->getGuestCpuLoad(&CpuUser, &CpuKernel, &CpuIdle); 395 mUser->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * CpuUser) / 100); 396 mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * CpuKernel) / 100); 397 mIdle->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * CpuIdle) / 100); 403 398 } 404 399 … … 416 411 } 417 412 418 void GuestRamUsage::preCollect(CollectorHints& /* hints */) 419 { 413 void GuestRamUsage::preCollect(CollectorHints& hints, uint64_t iTick) 414 { 415 mHAL->preCollect(hints, iTick); 420 416 } 421 417 422 418 void GuestRamUsage::collect() 423 419 { 424 #if 0 425 ULONG used; 426 int rc = mHAL->getProcessMemoryUsage(mProcess, &used); 427 if (RT_SUCCESS(rc)) 428 mUsed->put(used); 429 #endif 420 ULONG ulMemTotal = 0, ulMemFree = 0, ulMemBalloon = 0, ulMemCache = 0, ulPageTotal = 0, ulPageFree = 0; 421 422 mGuestHAL->getGuestMemLoad(&ulMemTotal, &ulMemFree, &ulMemBalloon, &ulMemCache, &ulPageTotal, &ulPageFree); 423 mTotal->put(ulMemTotal); 424 mFree->put(ulMemFree); 425 mBallooned->put(ulMemBalloon); 426 mCache->put(ulMemCache); 427 mPagedTotal->put(ulPageTotal); 428 mPagedFree->put(ulPageFree); 430 429 } 431 430
Note:
See TracChangeset
for help on using the changeset viewer.