VirtualBox

Changeset 11591 in vbox


Ignore:
Timestamp:
Aug 23, 2008 4:28:29 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
35220
Message:

r=bird: Added a review todo in CollectorHAL::getHostCpuMHz - bogus MP programming.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Performance.cpp

    r11583 r11591  
    9595int CollectorHAL::getHostCpuMHz(ULONG *mhz)
    9696{
     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. */
    9798    RTCPUID nProcessors = RTMpGetCount();
    9899
     
    106107
    107108    *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
    108130    return VINF_SUCCESS;
    109131}
     
    116138        {
    117139            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",
    119141                        this, __PRETTY_FUNCTION__, getName(), (void *)mObject));
    120142            collect();
     
    178200            mIdle->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * idleDiff / totalDiff));
    179201        }
    180    
     202
    181203        mUserPrev   = user;
    182204        mKernelPrev = kernel;
     
    260282            mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processKernel - mProcessKernelPrev ) / (hostTotal - mHostTotalPrev)));
    261283        }
    262    
     284
    263285        mHostTotalPrev     = hostTotal;
    264286        mProcessUserPrev   = processUser;
     
    330352    copyTo(data);
    331353}
    332    
     354
    333355void Metric::query(ULONG **data, ULONG *count)
    334356{
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette