Ejemplo n.º 1
0
STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval)(ULONG aUpdateInterval)
{
    AutoCaller autoCaller(this);
    if (FAILED(autoCaller.rc())) return autoCaller.rc();

    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    if (mStatUpdateInterval)
        if (aUpdateInterval == 0)
            RTTimerLRStop(mStatTimer);
        else
            RTTimerLRChangeInterval(mStatTimer, aUpdateInterval);
    else
        if (aUpdateInterval != 0)
        {
            RTTimerLRChangeInterval(mStatTimer, aUpdateInterval);
            RTTimerLRStart(mStatTimer, 0);
        }
    mStatUpdateInterval = aUpdateInterval;
    /* forward the information to the VMM device */
    VMMDev *pVMMDev = mParent->getVMMDev();
    /* MUST release all locks before calling VMM device as its critsect
     * has higher lock order than anything in Main. */
    alock.release();
    if (pVMMDev)
    {
        PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
        if (pVMMDevPort)
            pVMMDevPort->pfnSetStatisticsInterval(pVMMDevPort, aUpdateInterval);
    }

    return S_OK;
}