VirtualBox

Changeset 43453 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Sep 27, 2012 12:37:46 PM (12 years ago)
Author:
vboxsync
Message:

Main/Metrics: Fixed the issue causing unregistration of all metrics instead of ones related to single interface (#6345)

Location:
trunk/src/VBox/Main/src-server
Files:
4 edited

Legend:

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

    r43445 r43453  
    443443    PerformanceCollector *aCollector = m->pParent->performanceCollector();
    444444    unregisterMetrics (aCollector);
    445     HostNetworkInterfaceList::iterator it;
    446     for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
    447         (*it)->unregisterMetrics(aCollector, this);
    448445#endif /* VBOX_WITH_RESOURCE_USAGE_API */
     446    /*
     447     * Note that unregisterMetrics() has unregistered all metrics associated
     448     * with Host including network interface ones. We can destroy network
     449     * interface objects now.
     450     */
    449451    m->llNetIfs.clear();
    450452
  • trunk/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp

    r43445 r43453  
    124124    LogFlowThisFunc(("mInterfaceName={%ls}, mGuid={%s}\n",
    125125                      mInterfaceName.raw(), mGuid.toString().c_str()));
    126     aCollector->unregisterMetricsFor(objptr);
    127     aCollector->unregisterBaseMetricsFor(objptr);
     126    Utf8StrFmt name("Net/%ls/Load", mInterfaceName.raw());
     127    aCollector->unregisterMetricsFor(objptr, name + "/*");
     128    aCollector->unregisterBaseMetricsFor(objptr, name);
    128129}
    129130
  • trunk/src/VBox/Main/src-server/Performance.cpp

    r43445 r43453  
    11401140}
    11411141
     1142Filter::Filter(const com::Utf8Str name, const ComPtr<IUnknown> &aObject)
     1143{
     1144    processMetricList(name, aObject);
     1145}
     1146
    11421147void Filter::init(ComSafeArrayIn(IN_BSTR, metricNames),
    11431148                  ComSafeArrayIn(IUnknown *, objects))
  • trunk/src/VBox/Main/src-server/PerformanceImpl.cpp

    r43445 r43453  
    599599}
    600600
    601 void PerformanceCollector::unregisterBaseMetricsFor(const ComPtr<IUnknown> &aObject)
     601void PerformanceCollector::unregisterBaseMetricsFor(const ComPtr<IUnknown> &aObject, const Utf8Str name)
    602602{
    603603    //LogFlowThisFuncEnter();
    604604    AutoCaller autoCaller(this);
    605605    if (!SUCCEEDED(autoCaller.rc())) return;
     606
     607    pm::Filter filter(name, aObject);
    606608
    607609    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    609611    BaseMetricList::iterator it;
    610612    for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); ++it)
    611         if ((*it)->associatedWith(aObject))
     613        if (filter.match((*it)->getObject(), (*it)->getName()))
    612614        {
    613615            (*it)->unregister();
     
    619621}
    620622
    621 void PerformanceCollector::unregisterMetricsFor(const ComPtr<IUnknown> &aObject)
     623void PerformanceCollector::unregisterMetricsFor(const ComPtr<IUnknown> &aObject, const Utf8Str name)
    622624{
    623625    //LogFlowThisFuncEnter();
    624626    AutoCaller autoCaller(this);
    625627    if (!SUCCEEDED(autoCaller.rc())) return;
     628
     629    pm::Filter filter(name, aObject);
    626630
    627631    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    629633    MetricList::iterator it;
    630634    for (it = m.metrics.begin(); it != m.metrics.end();)
    631         if ((*it)->associatedWith(aObject))
     635        if (filter.match((*it)->getObject(), (*it)->getName()))
    632636        {
    633637            delete *it;
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