VirtualBox

Ignore:
Timestamp:
Feb 9, 2010 12:46:37 PM (15 years ago)
Author:
vboxsync
Message:

Add testcase for guest statistics

File:
1 edited

Legend:

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

    r26294 r26360  
    818818                CHECK_ERROR(guest, COMSETTER(StatisticsUpdateInterval)(uVal));
    819819        }
     820        /* Undocumented show guest statistics testcase. */
     821        else if (   !strcmp(a->argv[1], "--showgueststats")
     822                 || !strcmp(a->argv[1], "-showgueststats"))
     823        {
     824            /* guest is running; update IGuest */
     825            ComPtr <IGuest> guest;
     826
     827            rc = console->COMGETTER(Guest)(guest.asOutParam());
     828            if (SUCCEEDED(rc))
     829            {
     830                ULONG StatVal;
     831
     832                if (guest->GetStatistic(0, GuestStatisticType_SampleNumber, &StatVal) == S_OK)
     833                    printf("Statistics sample:      %d\n", StatVal);
     834                if (guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &StatVal) == S_OK)
     835                    printf("CPU load idle:          %d%%\n", StatVal);
     836                if (guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &StatVal) == S_OK)
     837                    printf("CPU load kernel:        %d%%\n", StatVal);
     838                if (guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &StatVal) == S_OK)
     839                    printf("CPU load user:          %d%%\n", StatVal);
     840                if (guest->GetStatistic(0, GuestStatisticType_Threads, &StatVal) == S_OK)
     841                    printf("Nr. of threads:         %d\n", StatVal);
     842                if (guest->GetStatistic(0, GuestStatisticType_Threads, &StatVal) == S_OK)
     843                    printf("Nr. of threads:         %d\n", StatVal);
     844                if (guest->GetStatistic(0, GuestStatisticType_Processes, &StatVal) == S_OK)
     845                    printf("Nr. of processes:       %d\n", StatVal);
     846                if (guest->GetStatistic(0, GuestStatisticType_Handles, &StatVal) == S_OK)
     847                    printf("Nr. of handles:         %d\n", StatVal);
     848                if (guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &StatVal) == S_OK)
     849                    printf("Memory load:            %d\n", StatVal);
     850                if (guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &StatVal) == S_OK)
     851                    printf("Total phys. memory:     %dMB\n", StatVal);
     852                if (guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &StatVal) == S_OK)
     853                    printf("Available phys. memory: %dMB\n", StatVal);
     854                if (guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &StatVal) == S_OK)
     855                    printf("Balloon size:           %dMB\n", StatVal);
     856                if (guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &StatVal) == S_OK)
     857                    printf("Total memory commit:    %dMB\n", StatVal);
     858                if (guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &StatVal) == S_OK)
     859                    printf("Kernel memory:          %dMB\n", StatVal);
     860                if (guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &StatVal) == S_OK)
     861                    printf("Paged kernel mem:       %dMB\n", StatVal);
     862                if (guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &StatVal) == S_OK)
     863                    printf("Locked kernel mem:      %dMB\n", StatVal);
     864                if (guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &StatVal) == S_OK)
     865                    printf("System cache:          %dMB\n", StatVal);
     866                if (guest->GetStatistic(0, GuestStatisticType_PageFileSize, &StatVal) == S_OK)
     867                    printf("Page file size:        %dMB\n", StatVal);
     868            }
     869        }
    820870        else if (!strcmp(a->argv[1], "teleport"))
    821871        {
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