VirtualBox

Changeset 27822 in vbox for trunk/src


Ignore:
Timestamp:
Mar 30, 2010 1:01:36 PM (15 years ago)
Author:
vboxsync
Message:

Removed guest statistics interface; to be merged with metrics.

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r27703 r27822  
    122122    VMINFO_NONE             = 0,
    123123    VMINFO_STANDARD         = 1,    /**< standard details */
    124     VMINFO_STATISTICS       = 2,    /**< guest statistics */
    125     VMINFO_FULL             = 3,    /**< both */
    126     VMINFO_MACHINEREADABLE  = 4,    /**< both, and make it machine readable */
    127     VMINFO_COMPACT          = 5
     124    VMINFO_FULL             = 2,    /**< both */
     125    VMINFO_MACHINEREADABLE  = 3,    /**< both, and make it machine readable */
     126    VMINFO_COMPACT          = 4
    128127} VMINFO_DETAILS;
    129128
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r27581 r27822  
    791791                CHECK_ERROR(guest, COMSETTER(MemoryBalloonSize)(uVal));
    792792        }
    793         else if (!strcmp(a->argv[1], "gueststatisticsinterval"))
    794         {
    795             if (a->argc != 3)
    796             {
    797                 errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
    798                 rc = E_FAIL;
    799                 break;
    800             }
    801             uint32_t uVal;
    802             int vrc;
    803             vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
    804             if (vrc != VINF_SUCCESS)
    805             {
    806                 errorArgument("Error parsing guest statistics interval '%s'", a->argv[2]);
    807                 rc = E_FAIL;
    808                 break;
    809             }
    810 
    811             /* guest is running; update IGuest */
    812             ComPtr <IGuest> guest;
    813 
    814             rc = console->COMGETTER(Guest)(guest.asOutParam());
    815             if (SUCCEEDED(rc))
    816                 CHECK_ERROR(guest, COMSETTER(StatisticsUpdateInterval)(uVal));
    817         }
    818         /* Undocumented show guest statistics testcase. */
    819         else if (!strcmp(a->argv[1], "showgueststats"))
    820         {
    821             /* guest is running; update IGuest */
    822             ComPtr <IGuest> guest;
    823 
    824             rc = console->COMGETTER(Guest)(guest.asOutParam());
    825             if (SUCCEEDED(rc))
    826             {
    827                 ULONG StatVal;
    828 
    829                 if (guest->GetStatistic(0, GuestStatisticType_SampleNumber, &StatVal) == S_OK)
    830                     RTPrintf("Statistics sample:      %u\n", StatVal);
    831                 if (guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &StatVal) == S_OK)
    832                     RTPrintf("CPU load idle:          %u%%\n", StatVal);
    833                 if (guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &StatVal) == S_OK)
    834                     RTPrintf("CPU load kernel:        %u%%\n", StatVal);
    835                 if (guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &StatVal) == S_OK)
    836                     RTPrintf("CPU load user:          %u%%\n", StatVal);
    837                 if (guest->GetStatistic(0, GuestStatisticType_Threads, &StatVal) == S_OK)
    838                     RTPrintf("Nr. of threads:         %u\n", StatVal);
    839                 if (guest->GetStatistic(0, GuestStatisticType_Processes, &StatVal) == S_OK)
    840                     RTPrintf("Nr. of processes:       %u\n", StatVal);
    841                 if (guest->GetStatistic(0, GuestStatisticType_Handles, &StatVal) == S_OK)
    842                     RTPrintf("Nr. of handles:         %u\n", StatVal);
    843                 if (guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &StatVal) == S_OK)
    844                     RTPrintf("Memory load:            %u\n", StatVal);
    845                 if (guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &StatVal) == S_OK)
    846                     RTPrintf("Total phys. memory:     %uMB\n", StatVal);
    847                 if (guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &StatVal) == S_OK)
    848                     RTPrintf("Available phys. memory: %uMB\n", StatVal);
    849                 if (guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &StatVal) == S_OK)
    850                     RTPrintf("Balloon size:           %uMB\n", StatVal);
    851                 if (guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &StatVal) == S_OK)
    852                     RTPrintf("Total memory commit:    %uMB\n", StatVal);
    853                 if (guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &StatVal) == S_OK)
    854                     RTPrintf("Kernel memory:          %uMB\n", StatVal);
    855                 if (guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &StatVal) == S_OK)
    856                     RTPrintf("Paged kernel mem:       %uMB\n", StatVal);
    857                 if (guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &StatVal) == S_OK)
    858                     RTPrintf("Locked kernel mem:      %uMB\n", StatVal);
    859                 if (guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &StatVal) == S_OK)
    860                     RTPrintf("System cache:          %uMB\n", StatVal);
    861                 if (guest->GetStatistic(0, GuestStatisticType_PageFileSize, &StatVal) == S_OK)
    862                     RTPrintf("Page file size:        %uMB\n", StatVal);
    863             }
    864         }
    865793        else if (!strcmp(a->argv[1], "teleport"))
    866794        {
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r27537 r27822  
    18061806            RTPrintf("Configured memory balloon size:      %d MB\n", guestVal);
    18071807    }
    1808     rc = machine->COMGETTER(StatisticsUpdateInterval)(&guestVal);
    1809     if (SUCCEEDED(rc))
    1810     {
    1811         if (details == VMINFO_MACHINEREADABLE)
    1812             RTPrintf("GuestStatisticsUpdateInterval=%d\n", guestVal);
    1813         else
    1814         {
    1815             if (guestVal == 0)
    1816                 RTPrintf("Statistics update:                   disabled\n");
    1817             else
    1818                 RTPrintf("Statistics update interval:          %d seconds\n", guestVal);
    1819         }
    1820     }
    18211808    if (details != VMINFO_MACHINEREADABLE)
    18221809        RTPrintf("\n");
    1823 
    1824     if (    console
    1825         &&  (   details == VMINFO_STATISTICS
    1826              || details == VMINFO_FULL
    1827              || details == VMINFO_MACHINEREADABLE))
    1828     {
    1829         ComPtr <IGuest> guest;
    1830 
    1831         rc = console->COMGETTER(Guest)(guest.asOutParam());
    1832         if (SUCCEEDED(rc))
    1833         {
    1834             ULONG statVal;
    1835 
    1836             rc = guest->GetStatistic(0, GuestStatisticType_SampleNumber, &statVal);
    1837             if (SUCCEEDED(rc))
    1838             {
    1839                 if (details == VMINFO_MACHINEREADABLE)
    1840                     RTPrintf("StatGuestSample=%d\n", statVal);
    1841                 else
    1842                     RTPrintf("Guest statistics for sample %d:\n\n", statVal);
    1843             }
    1844 
    1845             rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &statVal);
    1846             if (SUCCEEDED(rc))
    1847             {
    1848                 if (details == VMINFO_MACHINEREADABLE)
    1849                     RTPrintf("StatGuestLoadIdleCPU%d=%d\n", 0, statVal);
    1850                 else
    1851                     RTPrintf("CPU%d: CPU Load Idle          %-3d%%\n", 0, statVal);
    1852             }
    1853 
    1854             rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &statVal);
    1855             if (SUCCEEDED(rc))
    1856             {
    1857                 if (details == VMINFO_MACHINEREADABLE)
    1858                     RTPrintf("StatGuestLoadKernelCPU%d=%d\n", 0, statVal);
    1859                 else
    1860                     RTPrintf("CPU%d: CPU Load Kernel        %-3d%%\n", 0, statVal);
    1861             }
    1862 
    1863             rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &statVal);
    1864             if (SUCCEEDED(rc))
    1865             {
    1866                 if (details == VMINFO_MACHINEREADABLE)
    1867                     RTPrintf("StatGuestLoadUserCPU%d=%d\n", 0, statVal);
    1868                 else
    1869                     RTPrintf("CPU%d: CPU Load User          %-3d%%\n", 0, statVal);
    1870             }
    1871 
    1872             rc = guest->GetStatistic(0, GuestStatisticType_Threads, &statVal);
    1873             if (SUCCEEDED(rc))
    1874             {
    1875                 if (details == VMINFO_MACHINEREADABLE)
    1876                     RTPrintf("StatGuestThreadsCPU%d=%d\n", 0, statVal);
    1877                 else
    1878                     RTPrintf("CPU%d: Threads                %d\n", 0, statVal);
    1879             }
    1880 
    1881             rc = guest->GetStatistic(0, GuestStatisticType_Processes, &statVal);
    1882             if (SUCCEEDED(rc))
    1883             {
    1884                 if (details == VMINFO_MACHINEREADABLE)
    1885                     RTPrintf("StatGuestProcessesCPU%d=%d\n", 0, statVal);
    1886                 else
    1887                     RTPrintf("CPU%d: Processes              %d\n", 0, statVal);
    1888             }
    1889 
    1890             rc = guest->GetStatistic(0, GuestStatisticType_Handles, &statVal);
    1891             if (SUCCEEDED(rc))
    1892             {
    1893                 if (details == VMINFO_MACHINEREADABLE)
    1894                     RTPrintf("StatGuestHandlesCPU%d=%d\n", 0, statVal);
    1895                 else
    1896                     RTPrintf("CPU%d: Handles                %d\n", 0, statVal);
    1897             }
    1898 
    1899             rc = guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &statVal);
    1900             if (SUCCEEDED(rc))
    1901             {
    1902                 if (details == VMINFO_MACHINEREADABLE)
    1903                     RTPrintf("StatGuestMemoryLoadCPU%d=%d\n", 0, statVal);
    1904                 else
    1905                     RTPrintf("CPU%d: Memory Load            %d%%\n", 0, statVal);
    1906             }
    1907 
    1908             rc = guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &statVal);
    1909             if (SUCCEEDED(rc))
    1910             {
    1911                 if (details == VMINFO_MACHINEREADABLE)
    1912                     RTPrintf("StatGuestMemoryTotalPhysCPU%d=%d\n", 0, statVal);
    1913                 else
    1914                     RTPrintf("CPU%d: Total physical memory  %-4d MB\n", 0, statVal);
    1915             }
    1916 
    1917             rc = guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &statVal);
    1918             if (SUCCEEDED(rc))
    1919             {
    1920                 if (details == VMINFO_MACHINEREADABLE)
    1921                     RTPrintf("StatGuestMemoryFreePhysCPU%d=%d\n", 0, statVal);
    1922                 else
    1923                     RTPrintf("CPU%d: Free physical memory   %-4d MB\n", 0, statVal);
    1924             }
    1925 
    1926             rc = guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &statVal);
    1927             if (SUCCEEDED(rc))
    1928             {
    1929                 if (details == VMINFO_MACHINEREADABLE)
    1930                     RTPrintf("StatGuestMemoryBalloonCPU%d=%d\n", 0, statVal);
    1931                 else
    1932                     RTPrintf("CPU%d: Memory balloon size    %-4d MB\n", 0, statVal);
    1933             }
    1934 
    1935             rc = guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &statVal);
    1936             if (SUCCEEDED(rc))
    1937             {
    1938                 if (details == VMINFO_MACHINEREADABLE)
    1939                     RTPrintf("StatGuestMemoryCommittedCPU%d=%d\n", 0, statVal);
    1940                 else
    1941                     RTPrintf("CPU%d: Committed memory       %-4d MB\n", 0, statVal);
    1942             }
    1943 
    1944             rc = guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &statVal);
    1945             if (SUCCEEDED(rc))
    1946             {
    1947                 if (details == VMINFO_MACHINEREADABLE)
    1948                     RTPrintf("StatGuestMemoryTotalKernelCPU%d=%d\n", 0, statVal);
    1949                 else
    1950                     RTPrintf("CPU%d: Total kernel memory    %-4d MB\n", 0, statVal);
    1951             }
    1952 
    1953             rc = guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &statVal);
    1954             if (SUCCEEDED(rc))
    1955             {
    1956                 if (details == VMINFO_MACHINEREADABLE)
    1957                     RTPrintf("StatGuestMemoryPagedKernelCPU%d=%d\n", 0, statVal);
    1958                 else
    1959                     RTPrintf("CPU%d: Paged kernel memory    %-4d MB\n", 0, statVal);
    1960             }
    1961 
    1962             rc = guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &statVal);
    1963             if (SUCCEEDED(rc))
    1964             {
    1965                 if (details == VMINFO_MACHINEREADABLE)
    1966                     RTPrintf("StatGuestMemoryNonpagedKernelCPU%d=%d\n", 0, statVal);
    1967                 else
    1968                     RTPrintf("CPU%d: Nonpaged kernel memory %-4d MB\n", 0, statVal);
    1969             }
    1970 
    1971             rc = guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &statVal);
    1972             if (SUCCEEDED(rc))
    1973             {
    1974                 if (details == VMINFO_MACHINEREADABLE)
    1975                     RTPrintf("StatGuestSystemCacheSizeCPU%d=%d\n", 0, statVal);
    1976                 else
    1977                     RTPrintf("CPU%d: System cache size      %-4d MB\n", 0, statVal);
    1978             }
    1979 
    1980             rc = guest->GetStatistic(0, GuestStatisticType_PageFileSize, &statVal);
    1981             if (SUCCEEDED(rc))
    1982             {
    1983                 if (details == VMINFO_MACHINEREADABLE)
    1984                     RTPrintf("StatGuestPageFileSizeCPU%d=%d\n", 0, statVal);
    1985                 else
    1986                     RTPrintf("CPU%d: Page file size         %-4d MB\n", 0, statVal);
    1987             }
    1988 
    1989             RTPrintf("\n");
    1990         }
    1991         else
    1992         {
    1993             if (details != VMINFO_MACHINEREADABLE)
    1994             {
    1995                 RTPrintf("[!] FAILED calling console->getGuest at line %d!\n", __LINE__);
    1996                 GluePrintRCMessage(rc);
    1997             }
    1998         }
    1999     }
    20001810
    20011811    /*
     
    20291839    { "--details",          'D', RTGETOPT_REQ_NOTHING },
    20301840    { "-details",           'D', RTGETOPT_REQ_NOTHING },    // deprecated
    2031     { "--statistics",       'S', RTGETOPT_REQ_NOTHING },
    2032     { "-statistics",        'S', RTGETOPT_REQ_NOTHING },    // deprecated
    20331841    { "--machinereadable",  'M', RTGETOPT_REQ_NOTHING },
    20341842    { "-machinereadable",   'M', RTGETOPT_REQ_NOTHING },    // deprecated
     
    20401848    const char *VMNameOrUuid = NULL;
    20411849    bool fDetails = false;
    2042     bool fStatistics = false;
    20431850    bool fMachinereadable = false;
    20441851
     
    20551862            case 'D':   // --details
    20561863                fDetails = true;
    2057                 break;
    2058 
    2059             case 'S':   // --statistics
    2060                 fStatistics = true;
    20611864                break;
    20621865
     
    21091912        return 1;
    21101913
    2111     /* 2nd option can be -details, -statistics or -argdump */
     1914    /* 2nd option can be -details or -argdump */
    21121915    VMINFO_DETAILS details = VMINFO_NONE;
    21131916    if (fMachinereadable)
    21141917        details = VMINFO_MACHINEREADABLE;
    21151918    else
    2116     if (fDetails && fStatistics)
     1919    if (fDetails)
    21171920        details = VMINFO_FULL;
    21181921    else
    21191922    if (fDetails)
    21201923        details = VMINFO_STANDARD;
    2121     else
    2122     if (fStatistics)
    2123         details = VMINFO_STATISTICS;
    21241924
    21251925    ComPtr <IConsole> console;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r27537 r27822  
    120120    MODIFYVM_UARTMODE,
    121121    MODIFYVM_UART,
    122     MODIFYVM_GUESTSTATISTICSINTERVAL,
    123122    MODIFYVM_GUESTMEMORYBALLOON,
    124123    MODIFYVM_AUDIOCONTROLLER,
     
    216215    { "--uartmode",                 MODIFYVM_UARTMODE,                  RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
    217216    { "--uart",                     MODIFYVM_UART,                      RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
    218     { "--gueststatisticsinterval",  MODIFYVM_GUESTSTATISTICSINTERVAL,   RTGETOPT_REQ_UINT32 },
    219217    { "--guestmemoryballoon",       MODIFYVM_GUESTMEMORYBALLOON,        RTGETOPT_REQ_UINT32 },
    220218    { "--audiocontroller",          MODIFYVM_AUDIOCONTROLLER,           RTGETOPT_REQ_STRING },
     
    13951393            }
    13961394
    1397             case MODIFYVM_GUESTSTATISTICSINTERVAL:
    1398             {
    1399                 CHECK_ERROR(machine, COMSETTER(StatisticsUpdateInterval)(ValueUnion.u32));
    1400                 break;
    1401             }
    1402 
    14031395            case MODIFYVM_GUESTMEMORYBALLOON:
    14041396            {
  • trunk/src/VBox/Main/GuestImpl.cpp

    r27788 r27822  
    8787        mMemoryBalloonSize = 0;                     /* Default is no ballooning */
    8888
    89     ULONG aStatUpdateInterval;
    90     ret = mParent->machine()->COMGETTER(StatisticsUpdateInterval)(&aStatUpdateInterval);
    91     if (ret == S_OK)
    92         mStatUpdateInterval = aStatUpdateInterval;
    93     else
    94         mStatUpdateInterval = 0;                    /* Default is not to report guest statistics at all */
    95 
    96     /* invalidate all stats */
    97     for (int i=0;i<GuestStatisticType_MaxVal;i++)
    98         mCurrentGuestStat[i] = GUEST_STAT_INVALID;
    99 
    100     /* start with sample 0 */
    101     mCurrentGuestStat[GuestStatisticType_SampleNumber] = 0;
     89    mStatUpdateInterval = 0;                    /* Default is not to report guest statistics at all */
    10290    return S_OK;
    10391}
     
    230218}
    231219
    232 STDMETHODIMP Guest::COMGETTER(StatisticsUpdateInterval) (ULONG *aUpdateInterval)
     220HRESULT Guest::GetStatisticsUpdateInterval (ULONG *aUpdateInterval)
    233221{
    234222    CheckComArgOutPointerValid(aUpdateInterval);
     
    244232}
    245233
    246 STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval) (ULONG aUpdateInterval)
     234HRESULT Guest::SetStatisticsUpdateInterval (ULONG aUpdateInterval)
    247235{
    248236    AutoCaller autoCaller(this);
     
    251239    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    252240
    253     HRESULT ret = mParent->machine()->COMSETTER(StatisticsUpdateInterval)(aUpdateInterval);
    254     if (ret == S_OK)
    255     {
    256         mStatUpdateInterval = aUpdateInterval;
    257         /* forward the information to the VMM device */
    258         VMMDev *vmmDev = mParent->getVMMDev();
    259         if (vmmDev)
    260             vmmDev->getVMMDevPort()->pfnSetStatisticsInterval(vmmDev->getVMMDevPort(), aUpdateInterval);
    261     }
    262 
    263     return ret;
     241    mStatUpdateInterval = aUpdateInterval;
     242    /* forward the information to the VMM device */
     243    VMMDev *vmmDev = mParent->getVMMDev();
     244    if (vmmDev)
     245        vmmDev->getVMMDevPort()->pfnSetStatisticsInterval(vmmDev->getVMMDevPort(), aUpdateInterval);
     246
     247    return S_OK;
    264248}
    265249
     
    286270    return setError(VBOX_E_VM_ERROR,
    287271                    tr("VMM device is not available (is the VM running?)"));
    288 }
    289 
    290 STDMETHODIMP Guest::GetStatistic(ULONG aCpuId, GuestStatisticType_T aStatistic, ULONG *aStatVal)
    291 {
    292     CheckComArgExpr(aCpuId, aCpuId == 0);
    293     CheckComArgExpr(aStatistic, aStatistic < GuestStatisticType_MaxVal);
    294     CheckComArgOutPointerValid(aStatVal);
    295 
    296     /* Not available or not yet reported? In that case, just return with a proper error
    297      * but don't use setError(). */
    298     if (mCurrentGuestStat[aStatistic] == GUEST_STAT_INVALID)
    299         return E_INVALIDARG;
    300 
    301     *aStatVal = mCurrentGuestStat[aStatistic];
    302     return S_OK;
    303 }
    304 
    305 STDMETHODIMP Guest::SetStatistic(ULONG aCpuId, GuestStatisticType_T aStatistic, ULONG aStatVal)
    306 {
    307     CheckComArgExpr(aCpuId, aCpuId == 0);
    308     CheckComArgExpr(aStatistic, aStatistic < GuestStatisticType_MaxVal);
    309 
    310     /* internal method assumes that the caller knows what he's doing (no boundary checks) */
    311     mCurrentGuestStat[aStatistic] = aStatVal;
    312     return S_OK;
    313272}
    314273
  • trunk/src/VBox/Main/MachineImpl.cpp

    r27818 r27822  
    89018901    /* Create sub metrics */
    89028902    pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User",
    8903         "Percentage of processor time spent in user mode by VM process.");
     8903        "Percentage of processor time spent in user mode by the VM process.");
    89048904    pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel",
    8905         "Percentage of processor time spent in kernel mode by VM process.");
     8905        "Percentage of processor time spent in kernel mode by the VM process.");
    89068906    pm::SubMetric *ramUsageUsed  = new pm::SubMetric("RAM/Usage/Used",
    89078907        "Size of resident portion of VM process in memory.");
     
    89368936    aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed,
    89378937                                              new pm::AggregateMax()));
     8938
     8939
     8940    /* Guest metrics */
     8941
     8942    /* Create sub metrics */
     8943    pm::SubMetric *guestLoadUser = new pm::SubMetric("Guest/Cpu/Load/User",
     8944        "Percentage of processor time spent in user mode as seen by the guest.");
     8945    pm::SubMetric *guestLoadKernel = new pm::SubMetric("Guest/Cpu/Load/Kernel",
     8946        "Percentage of processor time spent in kernel mode as seen by the guest.");
     8947    pm::SubMetric *guestLoadIdle = new pm::SubMetric("Guest/Cpu/Load/Idle",
     8948        "Percentage of processor time spent idling as seen by the guest.");
     8949
     8950    /* The total amount of physical ram is fixed now, but we'll support dynamic guest ram configurations in the future. */
     8951    pm::SubMetric *guestMemTotal = new pm::SubMetric("Guest/RAM/Usage/Total",      "Total amount of physical guest RAM.");
     8952    pm::SubMetric *guestMemFree = new pm::SubMetric("Guest/RAM/Usage/Free",        "Free amount of physical guest RAM.");
     8953    pm::SubMetric *guestMemBalloon = new pm::SubMetric("Guest/RAM/Usage/Balloon",  "Amount of ballooned physical guest RAM.");
     8954    pm::SubMetric *guestMemCache = new pm::SubMetric("Guest/RAM/Usage/Cache",        "Total amount of guest (disk) cache memory.");
     8955
     8956    pm::SubMetric *guestPagedTotal = new pm::SubMetric("Guest/Pagefile/Usage/Total",    "Total amount of space in the page file.");
     8957    pm::SubMetric *guestPagedFree = new pm::SubMetric("Guest/Pagefile/Usage/Free",      "Total amount of free space in the page file.");
     8958
     8959    pm::SubMetric *guestSystemProc = new pm::SubMetric("Guest/System/Processes",      "Total number of guest processes.");
     8960    pm::SubMetric *guestSystemThread = new pm::SubMetric("Guest/System/Threads",      "Total number of guest threads.");
     8961
     8962    /* Create and register base metrics */
     8963    pm::BaseMetric *guestCpuLoad = new pm::GuestCpuLoad(hal, aMachine, guestLoadUser, guestLoadKernel, guestLoadIdle);
     8964    aCollector->registerBaseMetric(guestCpuLoad);
     8965
     8966    pm::BaseMetric *guestCpuMem = new pm::GuestRamUsage(hal, aMachine, guestMemTotal, guestMemFree, guestMemBalloon,
     8967                                                        guestMemCache, guestPagedTotal, guestPagedFree);
     8968    aCollector->registerBaseMetric(guestCpuMem);
     8969
     8970    pm::BaseMetric *guestSystem = new pm::GuestSystemUsage(hal, aMachine, guestSystemProc, guestSystemThread);
     8971    aCollector->registerBaseMetric(guestSystem);
     8972
     8973
     8974    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, 0));
     8975    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, new pm::AggregateAvg()));
     8976    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, new pm::AggregateMin()));
     8977    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, new pm::AggregateMax()));
     8978
     8979    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadKernel, 0));
     8980    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadKernel, new pm::AggregateAvg()));
     8981    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadKernel, new pm::AggregateMin()));
     8982    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadKernel, new pm::AggregateMax()));
     8983
     8984    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadIdle, 0));
     8985    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadIdle, new pm::AggregateAvg()));
     8986    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadIdle, new pm::AggregateMin()));
     8987    aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadIdle, new pm::AggregateMax()));
     8988
     8989    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemTotal, 0));
     8990    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemTotal, new pm::AggregateAvg()));
     8991    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemTotal, new pm::AggregateMin()));
     8992    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemTotal, new pm::AggregateMax()));
     8993
     8994    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemFree, 0));
     8995    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemFree, new pm::AggregateAvg()));
     8996    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemFree, new pm::AggregateMin()));
     8997    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemFree, new pm::AggregateMax()));
     8998
     8999    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemBalloon, 0));
     9000    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemBalloon, new pm::AggregateAvg()));
     9001    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemBalloon, new pm::AggregateMin()));
     9002    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemBalloon, new pm::AggregateMax()));
     9003
     9004    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemCache, 0));
     9005    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemCache, new pm::AggregateAvg()));
     9006    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemCache, new pm::AggregateMin()));
     9007    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestMemCache, new pm::AggregateMax()));
     9008
     9009    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedTotal, 0));
     9010    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedTotal, new pm::AggregateAvg()));
     9011    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedTotal, new pm::AggregateMin()));
     9012    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedTotal, new pm::AggregateMax()));
     9013
     9014    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, 0));
     9015    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, new pm::AggregateAvg()));
     9016    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, new pm::AggregateMin()));
     9017    aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, new pm::AggregateMax()));
     9018
     9019    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, 0));
     9020    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateAvg()));
     9021    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateMin()));
     9022    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateMax()));
     9023
     9024    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, 0));
     9025    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateAvg()));
     9026    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateMin()));
     9027    aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateMax()));
    89389028};
    89399029
  • trunk/src/VBox/Main/Performance.cpp

    r27645 r27822  
    293293}
    294294
     295
     296void GuestCpuLoad::init(ULONG period, ULONG length)
     297{
     298    mPeriod = period;
     299    mLength = length;
     300
     301    mUser->init(mLength);
     302    mKernel->init(mLength);
     303    mIdle->init(mLength);
     304}
     305
     306void GuestCpuLoad::preCollect(CollectorHints& hints)
     307{
     308}
     309
     310void GuestCpuLoad::collect()
     311{
     312#if 0
     313    uint64_t processUser, processKernel, hostTotal;
     314
     315    int rc = mHAL->getRawProcessCpuLoad(mProcess, &processUser, &processKernel, &hostTotal);
     316    if (RT_SUCCESS(rc))
     317    {
     318        if (hostTotal == mHostTotalPrev)
     319        {
     320            /* Nearly impossible, but... */
     321            mUser->put(0);
     322            mKernel->put(0);
     323        }
     324        else
     325        {
     326            mUser->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processUser - mProcessUserPrev) / (hostTotal - mHostTotalPrev)));
     327            mKernel->put((ULONG)(PM_CPU_LOAD_MULTIPLIER * (processKernel - mProcessKernelPrev ) / (hostTotal - mHostTotalPrev)));
     328        }
     329
     330        mHostTotalPrev     = hostTotal;
     331        mProcessUserPrev   = processUser;
     332        mProcessKernelPrev = processKernel;
     333    }
     334#endif
     335}
     336
     337void GuestRamUsage::init(ULONG period, ULONG length)
     338{
     339    mPeriod = period;
     340    mLength = length;
     341
     342    mTotal->init(mLength);
     343    mFree->init(mLength);
     344    mBallooned->init(mLength);
     345    mCache->init(mLength);
     346    mPagedTotal->init(mLength);
     347    mPagedFree->init(mLength);
     348}
     349
     350void GuestRamUsage::preCollect(CollectorHints& hints)
     351{
     352}
     353
     354void GuestRamUsage::collect()
     355{
     356#if 0
     357    ULONG used;
     358    int rc = mHAL->getProcessMemoryUsage(mProcess, &used);
     359    if (RT_SUCCESS(rc))
     360        mUsed->put(used);
     361#endif
     362}
     363
     364void GuestSystemUsage::init(ULONG period, ULONG length)
     365{
     366    mPeriod = period;
     367    mLength = length;
     368
     369    mThreads->init(mLength);
     370    mProcesses->init(mLength);
     371}
     372
     373void GuestSystemUsage::preCollect(CollectorHints& hints)
     374{
     375}
     376
     377void GuestSystemUsage::collect()
     378{
     379#if 0
     380    ULONG used;
     381    int rc = mHAL->getProcessMemoryUsage(mProcess, &used);
     382    if (RT_SUCCESS(rc))
     383        mUsed->put(used);
     384#endif
     385}
     386
     387
    295388void CircularBuffer::init(ULONG ulLength)
    296389{
  • trunk/src/VBox/Main/PerformanceImpl.cpp

    r26602 r27822  
    6868    "RAM/Usage/Free:min",
    6969    "RAM/Usage/Free:max",
     70    "Guest/RAM/Usage/Total",
     71    "Guest/RAM/Usage/Total:avg",
     72    "Guest/RAM/Usage/Total:min",
     73    "Guest/RAM/Usage/Total:max",
     74    "Guest/RAM/Usage/Free",
     75    "Guest/RAM/Usage/Free:avg",
     76    "Guest/RAM/Usage/Free:min",
     77    "Guest/RAM/Usage/Free:max",
     78    "Guest/RAM/Usage/Balloon",
     79    "Guest/RAM/Usage/Balloon:avg",
     80    "Guest/RAM/Usage/Balloon:min",
     81    "Guest/RAM/Usage/Balloon:max",
     82    "Guest/RAM/Usage/Cache",
     83    "Guest/RAM/Usage/Cache:avg",
     84    "Guest/RAM/Usage/Cache:min",
     85    "Guest/RAM/Usage/Cache:max",
     86    "Guest/Pagefile/Usage/Total",
     87    "Guest/Pagefile/Usage/Total:avg",
     88    "Guest/Pagefile/Usage/Total:min",
     89    "Guest/Pagefile/Usage/Total:max",
     90    "Guest/Pagefile/Usage/Free",
     91    "Guest/Pagefile/Usage/Free:avg",
     92    "Guest/Pagefile/Usage/Free:min",
     93    "Guest/Pagefile/Usage/Free:max",
     94    "Guest/System/Processes",
     95    "Guest/System/Processes:avg",
     96    "Guest/System/Processes:min",
     97    "Guest/System/Processes:max",
     98    "Guest/System/Threads",
     99    "Guest/System/Threads:avg",
     100    "Guest/System/Threads:min",
     101    "Guest/System/Threads:max",
    70102};
    71103
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r27797 r27822  
    431431        return VERR_INVALID_PARAMETER; /** @todo wrong error */
    432432
    433     guest->COMGETTER(StatisticsUpdateInterval)(&val);
     433    guest->GetStatisticsUpdateInterval(&val);
    434434    *pulInterval = val;
    435435    return VINF_SUCCESS;
     
    458458        return VERR_INVALID_PARAMETER; /** @todo wrong error */
    459459
     460#if 0
    460461    if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_CPU_LOAD_IDLE)
    461462        guest->SetStatistic(pGuestStats->u32CpuId, GuestStatisticType_CPULoad_Idle, pGuestStats->u32CpuLoad_Idle);
     
    517518    if (SUCCEEDED(rc))
    518519        guest->SetStatistic(pGuestStats->u32CpuId, GuestStatisticType_SampleNumber, sample+1);
    519 
     520#endif
    520521    return VINF_SUCCESS;
    521522}
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r27821 r27822  
    982982    <const name="Machine"         value="1"/>
    983983    <const name="Session"         value="2"/>
    984   </enum>
    985 
    986   <enum
    987     name="GuestStatisticType"
    988     uuid="aa7c1d71-aafe-47a8-9608-27d2d337cf55"
    989   >
    990     <desc>
    991       Statistics type for <link to="IGuest::getStatistic"/>.
    992     </desc>
    993 
    994     <const name="CPULoad_Idle"         value="0">
    995       <desc>
    996         Idle CPU load (0-100%) for last interval.
    997       </desc>
    998     </const>
    999     <const name="CPULoad_Kernel"       value="1">
    1000       <desc>
    1001         Kernel CPU load (0-100%) for last interval.
    1002       </desc>
    1003     </const>
    1004     <const name="CPULoad_User"         value="2">
    1005       <desc>
    1006         User CPU load (0-100%) for last interval.
    1007       </desc>
    1008     </const>
    1009     <const name="Threads"              value="3">
    1010       <desc>
    1011         Total number of threads in the system.
    1012       </desc>
    1013     </const>
    1014     <const name="Processes"            value="4">
    1015       <desc>
    1016         Total number of processes in the system.
    1017       </desc>
    1018     </const>
    1019     <const name="Handles"              value="5">
    1020       <desc>
    1021         Total number of handles in the system.
    1022       </desc>
    1023     </const>
    1024     <const name="MemoryLoad"           value="6">
    1025       <desc>
    1026         Memory load (0-100%).
    1027       </desc>
    1028     </const>
    1029     <const name="PhysMemTotal"         value="7">
    1030       <desc>
    1031         Total physical memory in megabytes.
    1032       </desc>
    1033     </const>
    1034     <const name="PhysMemAvailable"     value="8">
    1035       <desc>
    1036         Free physical memory in megabytes.
    1037       </desc>
    1038     </const>
    1039     <const name="PhysMemBalloon"       value="9">
    1040       <desc>
    1041         Ballooned physical memory in megabytes.
    1042       </desc>
    1043     </const>
    1044     <const name="MemCommitTotal"       value="10">
    1045       <desc>
    1046         Total amount of memory in the committed state in megabytes.
    1047       </desc>
    1048     </const>
    1049     <const name="MemKernelTotal"       value="11">
    1050       <desc>
    1051         Total amount of memory used by the guest OS's kernel in megabytes.
    1052       </desc>
    1053     </const>
    1054     <const name="MemKernelPaged"       value="12">
    1055       <desc>
    1056         Total amount of paged memory used by the guest OS's kernel in megabytes.
    1057       </desc>
    1058     </const>
    1059     <const name="MemKernelNonpaged"    value="13">
    1060       <desc>
    1061         Total amount of non-paged memory used by the guest OS's kernel in megabytes.
    1062       </desc>
    1063     </const>
    1064     <const name="MemSystemCache"       value="14">
    1065       <desc>
    1066         Total amount of memory used by the guest OS's system cache in megabytes.
    1067       </desc>
    1068     </const>
    1069     <const name="PageFileSize"         value="15">
    1070       <desc>
    1071         Pagefile size in megabytes.
    1072       </desc>
    1073     </const>
    1074     <const name="SampleNumber"         value="16">
    1075       <desc>
    1076         Statistics sample number
    1077       </desc>
    1078     </const>
    1079     <const name="MaxVal"               value="17"/>
    1080984  </enum>
    1081985
     
    42404144  <interface
    42414145     name="IMachine" extends="$unknown"
    4242      uuid="07862b34-c068-4667-be7d-1d722f496f20"
     4146     uuid="21f56f5d-d0fc-49e5-9ea7-91639278f424"
    42434147     wsmap="managed"
    42444148     >
     
    44454349    </attribute>
    44464350
    4447     <attribute name="statisticsUpdateInterval" type="unsigned long">
    4448       <desc>Initial interval to update guest statistics in seconds.</desc>
    4449     </attribute>
    4450 
    44514351    <attribute name="VRAMSize" type="unsigned long">
    44524352      <desc>Video memory size in megabytes.</desc>
     
    84538353  <interface
    84548354     name="IGuest" extends="$unknown"
    8455      uuid="a910034a-f95e-bc2c-6bae-eabc3ccd9c73"
     8355     uuid="2f6fba62-0d41-42fd-a891-51b7d87a9e84"
    84568356     wsmap="managed"
    84578357     >
     
    85188418    </attribute>
    85198419
    8520     <attribute name="statisticsUpdateInterval" type="unsigned long">
    8521       <desc>Interval to update guest statistics in seconds.</desc>
    8522     </attribute>
    8523 
    85248420    <method name="setCredentials">
    85258421      <desc>
     
    85508446          not be supported by all versions of the Additions.
    85518447        </desc>
    8552       </param>
    8553     </method>
    8554 
    8555     <method name="getStatistic">
    8556       <desc>
    8557         Query specified guest statistics as reported by the VirtualBox Additions.
    8558       </desc>
    8559       <param name="cpuId" type="unsigned long" dir="in">
    8560         <desc>Virtual CPU id; not relevant for all statistic types</desc>
    8561       </param>
    8562       <param name="statistic" type="GuestStatisticType" dir="in">
    8563         <desc>Statistic type.</desc>
    8564       </param>
    8565       <param name="statVal" type="unsigned long" dir="return">
    8566         <desc>Statistics value</desc>
    85678448      </param>
    85688449    </method>
  • trunk/src/VBox/Main/include/GuestImpl.h

    r27767 r27822  
    6565    STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize);
    6666    STDMETHOD(COMSETTER(MemoryBalloonSize)) (ULONG aMemoryBalloonSize);
    67     STDMETHOD(COMGETTER(StatisticsUpdateInterval)) (ULONG *aUpdateInterval);
    68     STDMETHOD(COMSETTER(StatisticsUpdateInterval)) (ULONG aUpdateInterval);
    6967
    7068    // IGuest methods
    7169    STDMETHOD(SetCredentials)(IN_BSTR aUserName, IN_BSTR aPassword,
    7270                              IN_BSTR aDomain, BOOL aAllowInteractiveLogon);
    73     STDMETHOD(GetStatistic)(ULONG aCpuId, GuestStatisticType_T aStatistic, ULONG *aStatVal);
    7471    STDMETHOD(ExecuteProgram)(IN_BSTR aCommand, ULONG aFlags,
    7572                              IN_BSTR aArguments, ComSafeArrayIn(IN_BSTR, aEnvironment),
     
    8582    void setSupportsGraphics (BOOL aSupportsGraphics);
    8683
    87     STDMETHOD(SetStatistic)(ULONG aCpuId, GuestStatisticType_T aStatistic, ULONG aStatVal);
     84    HRESULT GetStatisticsUpdateInterval(ULONG *aUpdateInterval);
     85    HRESULT SetStatisticsUpdateInterval(ULONG aUpdateInterval);
    8886
    8987    // for VirtualBoxSupportErrorInfoImpl
     
    115113    ULONG mStatUpdateInterval;
    116114
    117     ULONG mCurrentGuestStat[GuestStatisticType_MaxVal];
    118 
    119115    Console *mParent;
    120116    Data mData;
  • trunk/src/VBox/Main/include/Performance.h

    r26511 r27822  
    318318    };
    319319
     320
     321    class GuestCpuLoad : public BaseMetric
     322    {
     323    public:
     324        GuestCpuLoad(CollectorHAL *hal, ComPtr<IUnknown> object, SubMetric *user, SubMetric *kernel, SubMetric *idle)
     325        : BaseMetric(hal, "CPU/Load", object), mUser(user), mKernel(kernel), mIdle(idle) {};
     326        ~GuestCpuLoad() { delete mUser; delete mKernel; delete mIdle; };
     327
     328        void init(ULONG period, ULONG length);
     329        void preCollect(CollectorHints& hints);
     330        void collect();
     331        const char *getUnit() { return "%"; };
     332        ULONG getMinValue() { return 0; };
     333        ULONG getMaxValue() { return PM_CPU_LOAD_MULTIPLIER; };
     334        ULONG getScale() { return PM_CPU_LOAD_MULTIPLIER / 100; }
     335    protected:
     336        SubMetric *mUser;
     337        SubMetric *mKernel;
     338        SubMetric *mIdle;
     339    };
     340
     341    class GuestRamUsage : public BaseMetric
     342    {
     343    public:
     344        GuestRamUsage(CollectorHAL *hal, ComPtr<IUnknown> object, SubMetric *total, SubMetric *free, SubMetric *balloon, SubMetric *cache, SubMetric *pagedtotal, SubMetric *pagedfree)
     345        : BaseMetric(hal, "RAM/Usage", object), mTotal(total), mFree(free), mBallooned(balloon), mCache(cache), mPagedTotal(pagedtotal), mPagedFree(pagedfree) {};
     346        ~GuestRamUsage() { delete mTotal; delete mFree; delete mBallooned; delete mCache; delete mPagedTotal; delete mPagedFree; };
     347
     348        void init(ULONG period, ULONG length);
     349        void preCollect(CollectorHints& hints);
     350        void collect();
     351        const char *getUnit() { return "kB"; };
     352        ULONG getMinValue() { return 0; };
     353        ULONG getMaxValue() { return INT32_MAX; };
     354        ULONG getScale() { return 1; }
     355    private:
     356        SubMetric *mTotal, *mFree, *mBallooned, *mCache, *mPagedTotal, *mPagedFree;
     357    };
     358
     359    class GuestSystemUsage : public BaseMetric
     360    {
     361    public:
     362        GuestSystemUsage(CollectorHAL *hal, ComPtr<IUnknown> object, SubMetric *processes, SubMetric *threads)
     363        : BaseMetric(hal, "System/Usage", object), mProcesses(processes), mThreads(threads) {};
     364        ~GuestSystemUsage() { delete mProcesses; delete mThreads; };
     365
     366        void init(ULONG period, ULONG length);
     367        void preCollect(CollectorHints& hints);
     368        void collect();
     369        const char *getUnit() { return "kB"; };
     370        ULONG getMinValue() { return 0; };
     371        ULONG getMaxValue() { return INT32_MAX; };
     372        ULONG getScale() { return 1; }
     373    private:
     374        SubMetric *mProcesses, *mThreads;
     375    };
     376
    320377    /* Aggregate Functions **************************************************/
    321378    class Aggregate
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