VirtualBox

Changeset 43456 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Sep 28, 2012 6:36:09 AM (12 years ago)
Author:
vboxsync
Message:

Main/Metrics: Missing interface detection (#6345)

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/Performance.h

    r43453 r43456  
    497497    public:
    498498        HostNetworkLoadRaw(CollectorHAL *hal, ComPtr<IUnknown> object, com::Utf8Str name, com::Utf8Str ifname, SubMetric *rx, SubMetric *tx)
    499             : BaseMetric(hal, name, object), mInterfaceName(ifname), mRx(rx), mTx(tx), mRxPrev(0), mTxPrev(0) {};
     499            : BaseMetric(hal, name, object), mInterfaceName(ifname), mRx(rx), mTx(tx), mRxPrev(0), mTxPrev(0), mRc(VINF_SUCCESS) {};
    500500        ~HostNetworkLoadRaw() { delete mRx; delete mTx; };
    501501
     
    515515        uint64_t      mRxPrev;
    516516        uint64_t      mTxPrev;
     517        int           mRc;
    517518    };
    518519
  • trunk/src/VBox/Main/src-server/Performance.cpp

    r43453 r43456  
    663663void HostNetworkLoadRaw::preCollect(CollectorHints& /* hints */, uint64_t /* iTick */)
    664664{
     665    if (RT_FAILURE(mRc))
     666    {
     667        ComPtr<IHostNetworkInterface> networkInterface;
     668        ComPtr<IHost> host = getObject();
     669        HRESULT hrc = host->FindHostNetworkInterfaceByName(com::Bstr(mInterfaceName).raw(), networkInterface.asOutParam());
     670        if (SUCCEEDED(hrc))
     671        {
     672            LogRel(("Failed to collect network metrics for %s: %Rrc (%d).", mInterfaceName.c_str(), mRc, mRc));
     673            mRc = VINF_SUCCESS;
     674        }
     675    }
    665676}
    666677
     
    669680    uint64_t rx, tx, speed;
    670681
    671     int rc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &rx, &tx, &speed);
    672     if (RT_SUCCESS(rc))
     682    mRc = mHAL->getRawHostNetworkLoad(mInterfaceName.c_str(), &rx, &tx, &speed);
     683    if (RT_SUCCESS(mRc))
    673684    {
    674685        uint64_t rxDiff = rx - mRxPrev;
     
    691702        mTxPrev = tx;
    692703    }
     704    else
     705        LogFlowThisFunc(("Failed to collect data: %Rrc (%d)."
     706                         " Will update the list of interfaces...\n", mRc,mRc));
    693707}
    694708
     
    12791293            if (patternMatch((*it).second.c_str(), name.c_str()))
    12801294            {
    1281                 LogFlowThisFunc(("...found!\n"));
     1295                //LogFlowThisFunc(("...found!\n"));
    12821296                return true;
    12831297            }
  • trunk/src/VBox/Main/src-server/PerformanceImpl.cpp

    r43453 r43456  
    616616            ++n;
    617617        }
    618     LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p, marked %d metrics\n",
    619                 this, __PRETTY_FUNCTION__, (void *)aObject, n));
     618    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p, name=%s, marked %d metrics\n",
     619                this, __PRETTY_FUNCTION__, (void *)aObject, name.c_str(), n));
    620620    //LogFlowThisFuncLeave();
    621621}
     
    630630
    631631    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    632     LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p\n", this, __PRETTY_FUNCTION__, (void *)aObject));
     632    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p, name=%s\n", this,
     633                __PRETTY_FUNCTION__, (void *)aObject, name.c_str()));
    633634    MetricList::iterator it;
    634635    for (it = m.metrics.begin(); it != m.metrics.end();)
Note: See TracChangeset for help on using the changeset viewer.

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