Changeset 80178 in vbox for trunk/src/VBox/ValidationKit/utils/storage
- Timestamp:
- Aug 7, 2019 10:13:42 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/storage/IoPerf.cpp
r80066 r80178 80 80 IOPERFTEST_SEQ_READ, 81 81 IOPERFTEST_SEQ_WRITE, 82 IOPERFTEST_REV_READ, 83 IOPERFTEST_REV_WRITE, 82 84 IOPERFTEST_RND_READ, 83 85 IOPERFTEST_RND_WRITE, 84 IOPERFTEST_REV_READ,85 IOPERFTEST_REV_WRITE,86 86 IOPERFTEST_SEQ_READWRITE, 87 87 IOPERFTEST_RND_READWRITE, … … 174 174 /** Size of the random write buffer in 512 byte blocks. */ 175 175 uint32_t cRandWriteBlocks512B; 176 /** Start timestamp. */ 177 uint64_t tsStart; 176 178 /** Test dependent data. */ 177 179 union … … 279 281 /** Maximum number of concurrent requests for each job. */ 280 282 static uint32_t g_cReqsMax = 16; 281 283 /** Flag whether to open the file without caching enabled. */ 284 static bool g_fNoCache = true; 282 285 283 286 /** @name Configured tests, this must match the IOPERFTEST order. … … 290 293 IOPERFTEST_SEQ_READ, 291 294 IOPERFTEST_SEQ_WRITE, 295 IOPERFTEST_REV_READ, 296 IOPERFTEST_REV_WRITE, 292 297 IOPERFTEST_RND_READ, 293 298 IOPERFTEST_RND_WRITE, 294 IOPERFTEST_REV_READ,295 IOPERFTEST_REV_WRITE,296 299 IOPERFTEST_SEQ_READWRITE, 297 300 IOPERFTEST_RND_READWRITE, … … 331 334 AssertReturn(g_idxTest < RT_ELEMENTS(g_aenmTests), IOPERFTEST_SHUTDOWN); 332 335 333 return g_aenmTests[g_idxTest ];336 return g_aenmTests[g_idxTest++]; 334 337 } 335 338 … … 386 389 pJob->Tst.offNextSeq += pJob->cbIoBlock; 387 390 break; 388 389 391 case IOPERFTEST_REV_WRITE: 390 392 case IOPERFTEST_REV_READ: 393 offNext = pJob->Tst.offNextSeq; 394 if (pJob->Tst.offNextSeq == 0) 395 pJob->Tst.offNextSeq = pJob->cbTestSet; 396 else 397 pJob->Tst.offNextSeq -= pJob->cbIoBlock; 398 break; 391 399 case IOPERFTEST_RND_WRITE: 392 400 case IOPERFTEST_RND_READ: … … 448 456 449 457 /** 458 * Returns a stringified version of the test given. 459 * 460 * @returns Pointer to string representation of the test. 461 * @param enmTest The test to stringify. 462 */ 463 static const char *ioPerfJobTestStringify(IOPERFTEST enmTest) 464 { 465 switch (enmTest) 466 { 467 case IOPERFTEST_FIRST_WRITE: 468 return "FirstWrite"; 469 case IOPERFTEST_SEQ_WRITE: 470 return "SequentialWrite"; 471 case IOPERFTEST_SEQ_READ: 472 return "SequentialRead"; 473 case IOPERFTEST_REV_WRITE: 474 return "ReverseWrite"; 475 case IOPERFTEST_REV_READ: 476 return "ReverseRead"; 477 case IOPERFTEST_RND_WRITE: 478 return "RandomWrite"; 479 case IOPERFTEST_RND_READ: 480 return "RandomRead"; 481 case IOPERFTEST_SEQ_READWRITE: 482 return "SequentialReadWrite"; 483 case IOPERFTEST_RND_READWRITE: 484 return "RandomReadWrite"; 485 default: 486 AssertMsgFailed(("Invalid/unknown test selected: %d\n", enmTest)); 487 break; 488 } 489 490 return "INVALID_TEST"; 491 } 492 493 494 /** 450 495 * Initializes the test state for the current test. 451 496 * … … 462 507 pJob->Tst.offNextSeq = 0; 463 508 break; 464 465 509 case IOPERFTEST_REV_WRITE: 466 510 case IOPERFTEST_REV_READ: 511 pJob->Tst.offNextSeq = pJob->cbTestSet - pJob->cbIoBlock; 512 break; 467 513 case IOPERFTEST_RND_WRITE: 468 514 case IOPERFTEST_RND_READ: … … 476 522 } 477 523 524 RTTestISub(ioPerfJobTestStringify(pJob->enmTest)); 525 pJob->tsStart = RTTimeNanoTS(); 478 526 return VINF_SUCCESS; 479 527 } … … 488 536 static void ioPerfJobTestFinish(PIOPERFJOB pJob) 489 537 { 538 uint64_t nsRuntime = RTTimeNanoTS() - pJob->tsStart; 539 RTTestIValue("Runtime", nsRuntime, RTTESTUNIT_NS); 540 490 541 switch (pJob->enmTest) 491 542 { … … 493 544 case IOPERFTEST_SEQ_WRITE: 494 545 case IOPERFTEST_SEQ_READ: 495 break; /* Nothing to do. */496 497 546 case IOPERFTEST_REV_WRITE: 498 547 case IOPERFTEST_REV_READ: 548 break; /* Nothing to do. */ 549 499 550 case IOPERFTEST_RND_WRITE: 500 551 case IOPERFTEST_RND_READ: … … 522 573 case IOPERFTEST_SEQ_WRITE: 523 574 case IOPERFTEST_SEQ_READ: 524 return pJob->Tst.offNextSeq == pJob->cbTestSet;525 526 575 case IOPERFTEST_REV_WRITE: 527 576 case IOPERFTEST_REV_READ: 577 return pJob->Tst.offNextSeq == pJob->cbTestSet; 528 578 case IOPERFTEST_RND_WRITE: 529 579 case IOPERFTEST_RND_READ: … … 564 614 PIOPERFREQ pReq = &pJob->paIoReqs[cReqsQueued]; 565 615 ioPerfJobTestReqInit(pJob, pReq); 566 rc =RTIoQueueRequestPrepare(pJob->hIoQueue, &pJob->Hnd, pReq->enmOp,567 pReq->offXfer, pReq->pvXfer, pReq->cbXfer, 0 /*fReqFlags*/,568 pReq);616 RTTESTI_CHECK_RC(RTIoQueueRequestPrepare(pJob->hIoQueue, &pJob->Hnd, pReq->enmOp, 617 pReq->offXfer, pReq->pvXfer, pReq->cbXfer, 0 /*fReqFlags*/, 618 pReq), VINF_SUCCESS); 569 619 cReqsQueued++; 570 620 } … … 573 623 if ( RT_SUCCESS(rc) 574 624 && cReqsQueued) 575 rc = RTIoQueueCommit(pJob->hIoQueue); 625 { 626 RTTESTI_CHECK_RC(RTIoQueueCommit(pJob->hIoQueue), VINF_SUCCESS); 627 } 576 628 577 629 /* Enter wait loop and process completed requests. */ … … 581 633 uint32_t cCEvtCompleted = 0; 582 634 583 rc =RTIoQueueEvtWait(pJob->hIoQueue, paIoQCEvt, pJob->cReqsMax, 1 /*cMinWait*/,584 &cCEvtCompleted, 0 /*fFlags*/);635 RTTESTI_CHECK_RC(RTIoQueueEvtWait(pJob->hIoQueue, paIoQCEvt, pJob->cReqsMax, 1 /*cMinWait*/, 636 &cCEvtCompleted, 0 /*fFlags*/), VINF_SUCCESS); 585 637 if (RT_SUCCESS(rc)) 586 638 { … … 600 652 { 601 653 ioPerfJobTestReqInit(pJob, pReq); 602 rc =RTIoQueueRequestPrepare(pJob->hIoQueue, &pJob->Hnd, pReq->enmOp,603 pReq->offXfer, pReq->pvXfer, pReq->cbXfer, 0 /*fReqFlags*/,604 pReq);654 RTTESTI_CHECK_RC(RTIoQueueRequestPrepare(pJob->hIoQueue, &pJob->Hnd, pReq->enmOp, 655 pReq->offXfer, pReq->pvXfer, pReq->cbXfer, 0 /*fReqFlags*/, 656 pReq), VINF_SUCCESS); 605 657 cReqsThisQueued++; 606 658 } … … 612 664 if ( cReqsThisQueued 613 665 && RT_SUCCESS(rc)) 614 rc = RTIoQueueCommit(pJob->hIoQueue); 666 { 667 RTTESTI_CHECK_RC(RTIoQueueCommit(pJob->hIoQueue), VINF_SUCCESS); 668 } 615 669 } 616 670 } … … 780 834 if (RT_LIKELY(pJob->pszFilename)) 781 835 { 782 rc = RTFileOpen(&pJob->Hnd.u.hFile, pJob->pszFilename, RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE); 836 uint32_t fOpen = RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE | RTFILE_O_ASYNC_IO; 837 if (g_fNoCache) 838 fOpen |= RTFILE_O_NO_CACHE; 839 rc = RTFileOpen(&pJob->Hnd.u.hFile, pJob->pszFilename, fOpen); 783 840 if (RT_SUCCESS(rc)) 784 841 {
Note:
See TracChangeset
for help on using the changeset viewer.