VirtualBox

Changeset 21395 in vbox for trunk/src


Ignore:
Timestamp:
Jul 8, 2009 1:30:34 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49765
Message:

Stop performance counter sampling when the host goes into suspend mode. Restart it during resume.

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

Legend:

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

    r20977 r21395  
    256256    f3DAccelerationSupported = false;
    257257
     258#if 0
    258259#ifdef VBOX_WITH_CROGL
    259260    f3DAccelerationSupported = is3DAccelerationSupported();
    260261#endif /* VBOX_WITH_CROGL */
    261 
     262#endif
    262263    setReady(true);
    263264    return S_OK;
  • trunk/src/VBox/Main/HostPower.cpp

    r20220 r21395  
    5555            LogFunc (("SUSPEND\n"));
    5656
     57#ifdef VBOX_WITH_RESOURCE_USAGE_API
     58            /* Suspend performance sampling to avoid unnecessary callbacks due to jumps in time. */
     59            PerformanceCollector *perfcollector = mVirtualBox->performanceCollector();
     60
     61            if (perfcollector)
     62                perfcollector->suspendSampling();
     63#endif
    5764            mVirtualBox->getOpenedMachinesAndControls (machines, controls);
    5865
     
    103110
    104111            LogFunc (("Resumed %d VMs\n", resumed));
     112
     113#ifdef VBOX_WITH_RESOURCE_USAGE_API
     114            /* Resume the performance sampling. */
     115            PerformanceCollector *perfcollector = mVirtualBox->performanceCollector();
     116
     117            if (perfcollector)
     118                perfcollector->resumeSampling();
     119#endif
    105120
    106121            mConsoles.clear();
  • trunk/src/VBox/Main/PerformanceImpl.cpp

    r20826 r21395  
    522522}
    523523
     524void PerformanceCollector::suspendSampling()
     525{
     526    AutoCaller autoCaller (this);
     527    if (!SUCCEEDED (autoCaller.rc())) return;
     528
     529    int rc = RTTimerLRStop(m.sampler);
     530    AssertRC(rc);
     531}
     532
     533void PerformanceCollector::resumeSampling()
     534{
     535    AutoCaller autoCaller (this);
     536    if (!SUCCEEDED (autoCaller.rc())) return;
     537
     538    int rc = RTTimerLRStart(m.sampler, 0);
     539    AssertRC(rc);
     540}
     541
     542
    524543// private methods
    525544///////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Main/include/PerformanceImpl.h

    r19239 r21395  
    189189    void unregisterMetricsFor (const ComPtr <IUnknown> &object);
    190190
     191    void suspendSampling();
     192    void resumeSampling();
     193
    191194    // public methods for internal purposes only
    192195    // (ensure there is a caller and a read lock before calling them!)
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