VirtualBox

Ignore:
Timestamp:
Sep 5, 2007 8:34:25 AM (17 years ago)
Author:
vboxsync
Message:

Updates for guest statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp

    r4492 r4524  
    11841184            if (requestHeader->size != sizeof(VMMDevGetMemBalloonChangeRequest))
    11851185            {
     1186                AssertFailed();
    11861187                requestHeader->rc = VERR_INVALID_PARAMETER;
    11871188            }
     
    11971198                    /* Remember which mode the client has queried. */
    11981199                    pData->u32LastMemoryBalloonSize = pData->u32MemoryBalloonSize;
     1200                }
     1201
     1202                requestHeader->rc = VINF_SUCCESS;
     1203            }
     1204            break;
     1205        }
     1206
     1207        case VMMDevReq_GetStatisticsChangeRequest:
     1208        {
     1209            Log(("VMMDevReq_GetStatisticsChangeRequest\n"));
     1210            if (requestHeader->size != sizeof(VMMDevGetStatisticsChangeRequest))
     1211            {
     1212                AssertFailed();
     1213                requestHeader->rc = VERR_INVALID_PARAMETER;
     1214            }
     1215            else
     1216            {
     1217                VMMDevGetStatisticsChangeRequest *statIntervalChangeRequest = (VMMDevGetStatisticsChangeRequest*)requestHeader;
     1218                /* just pass on the information */
     1219                Log(("VMMDev: returning statistics interval %d seconds\n", pData->u32StatIntervalSize));
     1220                statIntervalChangeRequest->u32StatInterval = pData->u32StatIntervalSize;
     1221
     1222                if (statIntervalChangeRequest->eventAck == VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST)
     1223                {
     1224                    /* Remember which mode the client has queried. */
     1225                    pData->u32LastStatIntervalSize= pData->u32StatIntervalSize;
    11991226                }
    12001227
     
    16961723    return VINF_SUCCESS;
    16971724}
     1725
     1726static DECLCALLBACK(int) vmmdevSetStatisticsInterval(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval)
     1727{
     1728    VMMDevState *pData = IVMMDEVPORT_2_VMMDEVSTATE(pInterface);
     1729
     1730    /* Verify that the new resolution is different and that guest does not yet know about it. */
     1731    bool fSame = (pData->u32LastStatIntervalSize == ulStatInterval);
     1732
     1733    Log(("vmmdevSetStatisticsInterval: old=%d. new=%d\n", pData->u32LastStatIntervalSize, ulStatInterval));
     1734
     1735    if (!fSame)
     1736    {
     1737        /* we could validate the information here but hey, the guest can do that as well! */
     1738        pData->u32StatIntervalSize = ulStatInterval;
     1739
     1740        /* IRQ so the guest knows what's going on */
     1741        VMMDevNotifyGuest (pData, VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST);
     1742    }
     1743
     1744    return VINF_SUCCESS;
     1745}
     1746
    16981747
    16991748static DECLCALLBACK(int) vmmdevSetCredentials(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
     
    19852034    pData->Port.pfnRequestSeamlessChange  = vmmdevRequestSeamlessChange;
    19862035    pData->Port.pfnSetMemoryBalloon       = vmmdevSetMemoryBalloon;
     2036    pData->Port.pfnSetStatisticsInterval  = vmmdevSetStatisticsInterval;
    19872037
    19882038    /* Shared folder LED */
     
    21162166    /* disabled memory ballooning */
    21172167    pData->u32LastMemoryBalloonSize = 0;
     2168
     2169    /* disabled statistics updating */
     2170    pData->u32LastStatIntervalSize = 0;
    21182171
    21192172    /* Clear the event variables.
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