VirtualBox

Ignore:
Timestamp:
Oct 2, 2012 1:22:31 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81089
Message:

Main/Metrics: Alternative way to get link speed for old kernels (#6345)

File:
1 edited

Legend:

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

    r43456 r43507  
    5959}
    6060
    61 int CollectorHAL::getRawHostNetworkLoad(const char * /* name */, uint64_t * /* rx */, uint64_t * /* tx */, uint64_t */* speed */)
     61int CollectorHAL::getRawHostNetworkLoad(const char * /* name */, uint64_t * /* rx */, uint64_t * /* tx */)
    6262{
    6363    return E_NOTIMPL;
     
    656656    mRx->init(mLength);
    657657    mTx->init(mLength);
    658     uint64_t speed;
    659     int rc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &mRxPrev, &mTxPrev, &speed);
     658    int rc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &mRxPrev, &mTxPrev);
    660659    AssertRC(rc);
    661660}
     
    670669        if (SUCCEEDED(hrc))
    671670        {
    672             LogRel(("Failed to collect network metrics for %s: %Rrc (%d).", mInterfaceName.c_str(), mRc, mRc));
     671            LogRel(("Failed to collect network metrics for %s: %Rrc (%d).\n", mInterfaceName.c_str(), mRc, mRc));
    673672            mRc = VINF_SUCCESS;
    674673        }
     
    678677void HostNetworkLoadRaw::collect()
    679678{
    680     uint64_t rx, tx, speed;
    681 
    682     mRc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &rx, &tx, &speed);
     679    uint64_t rx, tx;
     680
     681    mRc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &rx, &tx);
    683682    if (RT_SUCCESS(mRc))
    684683    {
     
    686685        uint64_t txDiff = tx - mTxPrev;
    687686
    688         if (RT_UNLIKELY(speed * getPeriod() == 0))
    689         {
    690             Assert(speed * getPeriod());
    691             LogFlowThisFunc(("Impossible! speed=%llu period=%d.\n", speed, getPeriod()));
     687        if (RT_UNLIKELY(mSpeed * getPeriod() == 0))
     688        {
     689            Assert(mSpeed * getPeriod());
     690            LogFlowThisFunc(("Impossible! speed=%llu period=%d.\n", mSpeed, getPeriod()));
    692691            mRx->put(0);
    693692            mTx->put(0);
     
    695694        else
    696695        {
    697             mRx->put((ULONG)(PM_NETWORK_LOAD_MULTIPLIER * rxDiff / (speed * getPeriod())));
    698             mTx->put((ULONG)(PM_NETWORK_LOAD_MULTIPLIER * txDiff / (speed * getPeriod())));
     696            mRx->put((ULONG)(PM_NETWORK_LOAD_MULTIPLIER * rxDiff / (mSpeed * getPeriod())));
     697            mTx->put((ULONG)(PM_NETWORK_LOAD_MULTIPLIER * txDiff / (mSpeed * getPeriod())));
    699698        }
    700699
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