VirtualBox

Changeset 107560 in vbox for trunk/src


Ignore:
Timestamp:
Jan 9, 2025 8:56:01 AM (7 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166633
Message:

src/VBox/Main/testcase/tstCollector.cpp: Fixed warnings found by Parfait (assignment unused). Lots of renaming, needs further cleanup. jiraref:VBP-1424

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstCollector.cpp

    r106061 r107560  
    177177    {
    178178        RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    179         return 1;
     179        return rc;
    180180    }
    181181    rc = collector->getRawHostNetworkLoad(NETIFNAME, &hostRxStart, &hostTxStart);
     
    187187        {
    188188            RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc);
    189             return 1;
     189            return rc;
    190190        }
    191191
     
    196196        {
    197197            RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    198             return 1;
     198            return rc;
    199199        }
    200200        hostRxStop = hostRxStart;
     
    204204        {
    205205            RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc);
    206             return 1;
     206            return rc;
    207207        }
    208208        RTPrintf("tstCollector: host network speed = %llu bytes/sec (%llu mbit/sec)\n",
     
    218218    }
    219219
    220     return 0;
     220    return rc;
    221221}
    222222
     
    236236        {
    237237            RTPrintf("tstCollector: getHostFilesystemUsage() -> %Rrc\n", rc);
    238             return 1;
     238            return rc;
    239239        }
    240240        RTPrintf("tstCollector: host root fs total     = %lu MB\n", total);
     
    242242        RTPrintf("tstCollector: host root fs available = %lu MB\n\n", available);
    243243    }
    244     return 0;
     244    return rc;
    245245}
    246246
     
    260260        {
    261261            RTPrintf("tstCollector: getDiskListByFs(%s) -> %Rrc\n", FSNAME, rc);
    262             return 1;
     262            return rc;
    263263        }
    264264        if (disksUsage.empty())
    265265        {
    266266            RTPrintf("tstCollector: getDiskListByFs(%s) returned empty usage list\n", FSNAME);
    267             return 0;
     267            return VINF_SUCCESS;
    268268        }
    269269        if (disksLoad.empty())
    270270        {
    271271            RTPrintf("tstCollector: getDiskListByFs(%s) returned empty usage list\n", FSNAME);
    272             return 0;
     272            return VINF_SUCCESS;
    273273        }
    274274
     
    284284            {
    285285                RTPrintf("tstCollector: getHostDiskSize() -> %Rrc\n", rc);
    286                 return 1;
     286                return rc;
    287287            }
    288288        }
     
    297297            {
    298298                RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    299                 return 1;
     299                return rc;
    300300            }
    301301            rc = collector->getRawHostDiskLoad(it->c_str(), &diskMsStart, &totalMsStart);
     
    303303            {
    304304                RTPrintf("tstCollector: getRawHostDiskLoad() -> %Rrc\n", rc);
    305                 return 1;
     305                return rc;
    306306            }
    307307
     
    312312            {
    313313                RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    314                 return 1;
     314                return rc;
    315315            }
    316316            rc = collector->getRawHostDiskLoad(it->c_str(), &diskMsStop, &totalMsStop);
     
    318318            {
    319319                RTPrintf("tstCollector: getRawHostDiskLoad() -> %Rrc\n", rc);
    320                 return 1;
     320                return rc;
    321321            }
    322322            RTPrintf("tstCollector: host disk util    = %llu msec (%u.%u %%), total = %llu msec\n\n",
     
    328328    }
    329329
    330     return 0;
     330    return VINF_SUCCESS;
    331331}
    332332
     
    335335int main(int argc, char *argv[])
    336336{
    337     bool cpuTest, ramTest, netTest, diskTest, fsTest, perfTest;
    338     cpuTest = ramTest = netTest = diskTest = fsTest = perfTest = false;
    339337    /*
    340338     * Initialize the VBox runtime without loading
     
    344342    if (RT_FAILURE(rc))
    345343    {
    346         RTPrintf("tstCollector: RTR3InitExe() -> %d\n", rc);
    347         return 1;
    348     }
     344        RTPrintf("tstCollector: RTR3InitExe() -> %Rrc\n", rc);
     345        return RTEXITCODE_FAILURE;
     346    }
     347
     348    bool cpuTest, ramTest, netTest, diskTest, fsTest, perfTest;
     349
     350    cpuTest = ramTest = netTest = diskTest = fsTest = perfTest = false;
     351
    349352    if (argc > 1)
    350353    {
     
    372375            {
    373376                RTPrintf("tstCollector: Unknown option: %s\n", argv[i]);
    374                 return 2;
     377                return RTEXITCODE_SYNTAX;
    375378            }
    376379        }
     
    398401    {
    399402        RTPrintf("tstCollector: createMetricFactory() failed\n");
    400         return 1;
     403        return RTEXITCODE_FAILURE;
    401404    }
    402405
     
    425428    {
    426429        RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    427         return 1;
     430        return RTEXITCODE_FAILURE;
    428431    }
    429432    if (cpuTest)
     
    435438        {
    436439            RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc);
    437             return 1;
     440            return RTEXITCODE_FAILURE;
    438441        }
    439442        rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStart, &processKernelStart, &processTotalStart);
     
    441444        {
    442445            RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc);
    443             return 1;
     446            return RTEXITCODE_FAILURE;
    444447        }
    445448
     
    450453        {
    451454            RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    452             return 1;
     455            return RTEXITCODE_FAILURE;
    453456        }
    454457        rc = collector->getRawHostCpuLoad(&hostUserStop, &hostKernelStop, &hostIdleStop);
     
    456459        {
    457460            RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc);
    458             return 1;
     461            return RTEXITCODE_FAILURE;
    459462        }
    460463        rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStop, &processKernelStop, &processTotalStop);
     
    462465        {
    463466            RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc);
    464             return 1;
     467            return RTEXITCODE_FAILURE;
    465468        }
    466469        hostTotal = hostUserStop - hostUserStart
     
    488491        {
    489492            RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    490             return 1;
     493            return RTEXITCODE_FAILURE;
    491494        }
    492495        rc = collector->getRawHostCpuLoad(&hostUserStart, &hostKernelStart, &hostIdleStart);
     
    494497        {
    495498            RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc);
    496             return 1;
     499            return RTEXITCODE_FAILURE;
    497500        }
    498501        rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStart, &processKernelStart, &processTotalStart);
     
    500503        {
    501504            RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc);
    502             return 1;
     505            return RTEXITCODE_FAILURE;
    503506        }
    504507        start = RTTimeMilliTS();
     
    509512        {
    510513            RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc);
    511             return 1;
     514            return RTEXITCODE_FAILURE;
    512515        }
    513516        rc = collector->getRawHostCpuLoad(&hostUserStop, &hostKernelStop, &hostIdleStop);
     
    515518        {
    516519            RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc);
    517             return 1;
     520            return RTEXITCODE_FAILURE;
    518521        }
    519522        rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStop, &processKernelStop, &processTotalStop);
     
    521524        {
    522525            RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc);
    523             return 1;
     526            return RTEXITCODE_FAILURE;
    524527        }
    525528        hostTotal = hostUserStop - hostUserStart
     
    553556        {
    554557            RTPrintf("tstCollector: getHostMemoryUsage() -> %Rrc\n", rc);
    555             return 1;
    556         }
     558            return RTEXITCODE_FAILURE;
     559        }
     560
    557561        rc = collector->getProcessMemoryUsage(RTProcSelf(), &processUsed);
    558562        if (RT_FAILURE(rc))
    559563        {
    560564            RTPrintf("tstCollector: getProcessMemoryUsage() -> %Rrc\n", rc);
    561             return 1;
    562         }
     565            return RTEXITCODE_FAILURE;
     566        }
     567
    563568        RTPrintf("tstCollector: host mem total     = %lu kB\n", total);
    564569        RTPrintf("tstCollector: host mem used      = %lu kB\n", used);
     
    568573
    569574    if (netTest)
    570         rc = testNetwork(collector);
     575        testNetwork(collector);
    571576    if (fsTest)
    572     rc = testFsUsage(collector);
     577        testFsUsage(collector);
    573578    if (diskTest)
    574         rc = testDisk(collector);
     579        testDisk(collector);
     580
    575581    if (perfTest)
    576582    {
    577583        RTPrintf("tstCollector: TESTING - Performance\n\n");
    578 
    579584        measurePerformance(collector, argv[0], 100);
    580585    }
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