VirtualBox

Changeset 4649 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Sep 10, 2007 8:50:51 AM (17 years ago)
Author:
vboxsync
Message:

showvminfo -statistics

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

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

    r4372 r4649  
    278278        RTPrintf("VBoxManage showvminfo       <uuid>|<name>\n"
    279279                 "                            [-details]\n"
     280                 "                            [-statistics]\n"
    280281                 "\n");
    281282    }
     
    705706static HRESULT showVMInfo (ComPtr <IVirtualBox> virtualBox, ComPtr<IMachine> machine,
    706707                           ComPtr <IConsole> console = ComPtr <IConsole> (),
    707                            bool fDetails = false)
     708                           VMINFO_DETAILS details = VMINFO_NONE)
    708709{
    709710    HRESULT rc;
     
    15361537    }
    15371538
    1538     if (fDetails)
     1539    if (details == VMINFO_STANDARD || details == VMINFO_FULL)
    15391540    {
    15401541        Bstr description;
     
    15441545            RTPrintf("Description:\n%lS\n", description.raw());
    15451546        }
     1547    }
     1548    if (details == VMINFO_STATISTICS || details == VMINFO_FULL)
     1549    {
     1550        ComPtr <IGuest> Guest;
     1551        ULONG statVal;
     1552
     1553        CHECK_ERROR_RET(console, COMGETTER(Guest)(Guest.asOutParam()), rc);
     1554
     1555        rc = Guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &statVal);
     1556        if (rc == S_OK)
     1557            RTPrintf("CPU%d: CPU Load Idle          %-3d%%\n", 0, statVal);
     1558
     1559        rc = Guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &statVal);
     1560        if (rc == S_OK)
     1561            RTPrintf("CPU%d: CPU Load Kernel        %-3d%%\n", 0, statVal);
     1562
     1563        rc = Guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &statVal);
     1564        if (rc == S_OK)
     1565            RTPrintf("CPU%d: CPU Load User          %-3d%%\n", 0, statVal);
     1566
     1567        rc = Guest->GetStatistic(0, GuestStatisticType_Threads, &statVal);
     1568        if (rc == S_OK)
     1569            RTPrintf("CPU%d: Threads                %d%%\n", 0, statVal);
     1570
     1571        rc = Guest->GetStatistic(0, GuestStatisticType_Processes, &statVal);
     1572        if (rc == S_OK)
     1573            RTPrintf("CPU%d: Processes              %d%%\n", 0, statVal);
     1574
     1575        rc = Guest->GetStatistic(0, GuestStatisticType_Handles, &statVal);
     1576        if (rc == S_OK)
     1577            RTPrintf("CPU%d: Handles                %d%%\n", 0, statVal);
     1578
     1579        rc = Guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &statVal);
     1580        if (rc == S_OK)
     1581            RTPrintf("CPU%d: Memory Load            %d%%\n", 0, statVal);
     1582
     1583        rc = Guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &statVal);
     1584        if (rc == S_OK)
     1585            RTPrintf("CPU%d: Total physical memory  %-4d MB\n", 0, statVal);
     1586
     1587        rc = Guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &statVal);
     1588        if (rc == S_OK)
     1589            RTPrintf("CPU%d: Free physical memory   %-4d MB\n", 0, statVal);
     1590
     1591        rc = Guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &statVal);
     1592        if (rc == S_OK)
     1593            RTPrintf("CPU%d: Memory balloon size    %-4d MB\n", 0, statVal);
     1594
     1595        rc = Guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &statVal);
     1596        if (rc == S_OK)
     1597            RTPrintf("CPU%d: Committed memory       %-4d MB\n", 0, statVal);
     1598
     1599        rc = Guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &statVal);
     1600        if (rc == S_OK)
     1601            RTPrintf("CPU%d: Total kernel memory    %-4d MB\n", 0, statVal);
     1602
     1603        rc = Guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &statVal);
     1604        if (rc == S_OK)
     1605            RTPrintf("CPU%d: Paged kernel memory    %-4d MB\n", 0, statVal);
     1606
     1607        rc = Guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &statVal);
     1608        if (rc == S_OK)
     1609            RTPrintf("CPU%d: Nonpaged kernel memory %-4d MB\n", 0, statVal);
     1610
     1611        rc = Guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &statVal);
     1612        if (rc == S_OK)
     1613            RTPrintf("CPU%d: System cache size      %-4d MB\n", 0, statVal);
     1614
     1615        rc = Guest->GetStatistic(0, GuestStatisticType_PageFileSize, &statVal);
     1616        if (rc == S_OK)
     1617            RTPrintf("CPU%d: Page file size         %-4d MB\n", 0, statVal);
    15461618    }
    15471619
     
    15881660        return 1;
    15891661
    1590     /* 2nd option can be -details */
     1662    /* 2nd option can be -details or -statistics */
     1663    VMINFO_DETAILS details = VMINFO_NONE;
    15911664    bool fDetails = false;
    1592     if ((argc == 2) && !strcmp(argv[1], "-details"))
    1593         fDetails = true;
     1665    bool fStatistics = false;
     1666    for (int i=1;i<argc;i++)
     1667    {
     1668        if (!strcmp(argv[i], "-details"))
     1669            fDetails = true;
     1670        else
     1671        if (!strcmp(argv[i], "-statistics"))
     1672            fStatistics = true;
     1673    }
     1674    if (fDetails && fStatistics)
     1675        details = VMINFO_FULL;
     1676    else
     1677    if (fDetails)
     1678        details = VMINFO_STANDARD;
     1679    else
     1680    if (fStatistics)
     1681        details = VMINFO_STATISTICS;
    15941682
    15951683    ComPtr <IConsole> console;
     
    16041692        rc = session->COMGETTER(Console)(console.asOutParam());
    16051693
    1606     rc = showVMInfo (virtualBox, machine, console, fDetails);
     1694    rc = showVMInfo (virtualBox, machine, console, details);
    16071695
    16081696    if (console)
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r4071 r4649  
    7070extern bool fInternalMode;
    7171
     72/** showVMInfo details */
     73typedef enum
     74{
     75    VMINFO_NONE         = 0,
     76    VMINFO_STANDARD     = 1,    /* standard details */
     77    VMINFO_STATISTICS   = 2,    /* guest statistics */
     78    VMINFO_FULL         = 3,    /* both */
     79} VMINFO_DETAILS;
     80
    7281/*
    7382 * Prototypes
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