- Timestamp:
- Jan 9, 2025 8:56:01 AM (7 weeks ago)
- svn:sync-xref-src-repo-rev:
- 166633
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstCollector.cpp
r106061 r107560 177 177 { 178 178 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 179 return 1;179 return rc; 180 180 } 181 181 rc = collector->getRawHostNetworkLoad(NETIFNAME, &hostRxStart, &hostTxStart); … … 187 187 { 188 188 RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc); 189 return 1;189 return rc; 190 190 } 191 191 … … 196 196 { 197 197 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 198 return 1;198 return rc; 199 199 } 200 200 hostRxStop = hostRxStart; … … 204 204 { 205 205 RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc); 206 return 1;206 return rc; 207 207 } 208 208 RTPrintf("tstCollector: host network speed = %llu bytes/sec (%llu mbit/sec)\n", … … 218 218 } 219 219 220 return 0;220 return rc; 221 221 } 222 222 … … 236 236 { 237 237 RTPrintf("tstCollector: getHostFilesystemUsage() -> %Rrc\n", rc); 238 return 1;238 return rc; 239 239 } 240 240 RTPrintf("tstCollector: host root fs total = %lu MB\n", total); … … 242 242 RTPrintf("tstCollector: host root fs available = %lu MB\n\n", available); 243 243 } 244 return 0;244 return rc; 245 245 } 246 246 … … 260 260 { 261 261 RTPrintf("tstCollector: getDiskListByFs(%s) -> %Rrc\n", FSNAME, rc); 262 return 1;262 return rc; 263 263 } 264 264 if (disksUsage.empty()) 265 265 { 266 266 RTPrintf("tstCollector: getDiskListByFs(%s) returned empty usage list\n", FSNAME); 267 return 0;267 return VINF_SUCCESS; 268 268 } 269 269 if (disksLoad.empty()) 270 270 { 271 271 RTPrintf("tstCollector: getDiskListByFs(%s) returned empty usage list\n", FSNAME); 272 return 0;272 return VINF_SUCCESS; 273 273 } 274 274 … … 284 284 { 285 285 RTPrintf("tstCollector: getHostDiskSize() -> %Rrc\n", rc); 286 return 1;286 return rc; 287 287 } 288 288 } … … 297 297 { 298 298 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 299 return 1;299 return rc; 300 300 } 301 301 rc = collector->getRawHostDiskLoad(it->c_str(), &diskMsStart, &totalMsStart); … … 303 303 { 304 304 RTPrintf("tstCollector: getRawHostDiskLoad() -> %Rrc\n", rc); 305 return 1;305 return rc; 306 306 } 307 307 … … 312 312 { 313 313 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 314 return 1;314 return rc; 315 315 } 316 316 rc = collector->getRawHostDiskLoad(it->c_str(), &diskMsStop, &totalMsStop); … … 318 318 { 319 319 RTPrintf("tstCollector: getRawHostDiskLoad() -> %Rrc\n", rc); 320 return 1;320 return rc; 321 321 } 322 322 RTPrintf("tstCollector: host disk util = %llu msec (%u.%u %%), total = %llu msec\n\n", … … 328 328 } 329 329 330 return 0;330 return VINF_SUCCESS; 331 331 } 332 332 … … 335 335 int main(int argc, char *argv[]) 336 336 { 337 bool cpuTest, ramTest, netTest, diskTest, fsTest, perfTest;338 cpuTest = ramTest = netTest = diskTest = fsTest = perfTest = false;339 337 /* 340 338 * Initialize the VBox runtime without loading … … 344 342 if (RT_FAILURE(rc)) 345 343 { 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 349 352 if (argc > 1) 350 353 { … … 372 375 { 373 376 RTPrintf("tstCollector: Unknown option: %s\n", argv[i]); 374 return 2;377 return RTEXITCODE_SYNTAX; 375 378 } 376 379 } … … 398 401 { 399 402 RTPrintf("tstCollector: createMetricFactory() failed\n"); 400 return 1;403 return RTEXITCODE_FAILURE; 401 404 } 402 405 … … 425 428 { 426 429 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 427 return 1;430 return RTEXITCODE_FAILURE; 428 431 } 429 432 if (cpuTest) … … 435 438 { 436 439 RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc); 437 return 1;440 return RTEXITCODE_FAILURE; 438 441 } 439 442 rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStart, &processKernelStart, &processTotalStart); … … 441 444 { 442 445 RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc); 443 return 1;446 return RTEXITCODE_FAILURE; 444 447 } 445 448 … … 450 453 { 451 454 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 452 return 1;455 return RTEXITCODE_FAILURE; 453 456 } 454 457 rc = collector->getRawHostCpuLoad(&hostUserStop, &hostKernelStop, &hostIdleStop); … … 456 459 { 457 460 RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc); 458 return 1;461 return RTEXITCODE_FAILURE; 459 462 } 460 463 rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStop, &processKernelStop, &processTotalStop); … … 462 465 { 463 466 RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc); 464 return 1;467 return RTEXITCODE_FAILURE; 465 468 } 466 469 hostTotal = hostUserStop - hostUserStart … … 488 491 { 489 492 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 490 return 1;493 return RTEXITCODE_FAILURE; 491 494 } 492 495 rc = collector->getRawHostCpuLoad(&hostUserStart, &hostKernelStart, &hostIdleStart); … … 494 497 { 495 498 RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc); 496 return 1;499 return RTEXITCODE_FAILURE; 497 500 } 498 501 rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStart, &processKernelStart, &processTotalStart); … … 500 503 { 501 504 RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc); 502 return 1;505 return RTEXITCODE_FAILURE; 503 506 } 504 507 start = RTTimeMilliTS(); … … 509 512 { 510 513 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 511 return 1;514 return RTEXITCODE_FAILURE; 512 515 } 513 516 rc = collector->getRawHostCpuLoad(&hostUserStop, &hostKernelStop, &hostIdleStop); … … 515 518 { 516 519 RTPrintf("tstCollector: getRawHostCpuLoad() -> %Rrc\n", rc); 517 return 1;520 return RTEXITCODE_FAILURE; 518 521 } 519 522 rc = collector->getRawProcessCpuLoad(RTProcSelf(), &processUserStop, &processKernelStop, &processTotalStop); … … 521 524 { 522 525 RTPrintf("tstCollector: getRawProcessCpuLoad() -> %Rrc\n", rc); 523 return 1;526 return RTEXITCODE_FAILURE; 524 527 } 525 528 hostTotal = hostUserStop - hostUserStart … … 553 556 { 554 557 RTPrintf("tstCollector: getHostMemoryUsage() -> %Rrc\n", rc); 555 return 1; 556 } 558 return RTEXITCODE_FAILURE; 559 } 560 557 561 rc = collector->getProcessMemoryUsage(RTProcSelf(), &processUsed); 558 562 if (RT_FAILURE(rc)) 559 563 { 560 564 RTPrintf("tstCollector: getProcessMemoryUsage() -> %Rrc\n", rc); 561 return 1; 562 } 565 return RTEXITCODE_FAILURE; 566 } 567 563 568 RTPrintf("tstCollector: host mem total = %lu kB\n", total); 564 569 RTPrintf("tstCollector: host mem used = %lu kB\n", used); … … 568 573 569 574 if (netTest) 570 rc =testNetwork(collector);575 testNetwork(collector); 571 576 if (fsTest) 572 rc =testFsUsage(collector);577 testFsUsage(collector); 573 578 if (diskTest) 574 rc = testDisk(collector); 579 testDisk(collector); 580 575 581 if (perfTest) 576 582 { 577 583 RTPrintf("tstCollector: TESTING - Performance\n\n"); 578 579 584 measurePerformance(collector, argv[0], 100); 580 585 }
Note:
See TracChangeset
for help on using the changeset viewer.