VirtualBox

Changeset 23811 in vbox


Ignore:
Timestamp:
Oct 15, 2009 5:52:07 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53556
Message:

AsyncCompletion Stress test: Bugfixes. Correctly calculate the write chance for growing files and adjust the range of start offsets if the file is growing to let it grow more quickly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp

    r23713 r23811  
    8383#define SEGMENT_SIZE_MAX (TEST_PATTERN_SIZE)
    8484/** Maximum number of active tasks. */
    85 #define TASK_ACTIVE_MAX (512)
     85#define TASK_ACTIVE_MAX (1)
    8686/** Maximum size of a transfer. */
    8787#define TASK_TRANSFER_SIZE_MAX (_1M)
     
    168168    {
    169169        size_t cbCompare;
    170         unsigned iSeg = off / pTestFile->cbFileSegment;;
     170        unsigned iSeg = off / pTestFile->cbFileSegment;
    171171        PPDMACTESTFILESEG pSeg = &pTestFile->paSegs[iSeg];
    172172        uint8_t *pbTestPattern;
     
    196196    {
    197197        size_t cbFill;
    198         unsigned iSeg = off / pTestFile->cbFileSegment;;
     198        unsigned iSeg = off / pTestFile->cbFileSegment;
    199199        PPDMACTESTFILESEG pSeg = &pTestFile->paSegs[iSeg];
    200200        uint8_t *pbTestPattern;
     
    228228    {
    229229        offMax =   (pTestFile->cbFileMax - pTestFile->cbFileCurr) < pTestTask->DataSeg.cbSeg
    230                  ? pTestFile->cbFileCurr + pTestTask->DataSeg.cbSeg
     230                 ? pTestFile->cbFileMax - pTestTask->DataSeg.cbSeg
    231231                 : pTestFile->cbFileCurr;
    232232    }
     
    234234        offMax = pTestFile->cbFileMax - pTestTask->DataSeg.cbSeg;
    235235
    236     pTestTask->off = RTRandU64Ex(0, offMax) & ~511;
     236    uint64_t offMin;
     237
     238    /*
     239     * If we reached the maximum file size write in the whole file
     240     * otherwise we will enforce the range for random offsets to let it grow
     241     * more quickly.
     242     */
     243    if (pTestFile->cbFileCurr == pTestFile->cbFileMax)
     244        offMin = 0;
     245    else
     246        offMin = (offMax - pTestTask->DataSeg.cbSeg) < 0 ? 0 : (offMax - pTestTask->DataSeg.cbSeg);
     247
     248
     249    pTestTask->off = RTRandU64Ex(offMin, offMax) & ~511;
    237250
    238251    /* Set new file size of required */
    239252    if ((uint64_t)pTestTask->off + pTestTask->DataSeg.cbSeg > pTestFile->cbFileCurr)
    240253        pTestFile->cbFileCurr = pTestTask->off + pTestTask->DataSeg.cbSeg;
     254
     255    AssertMsg(pTestFile->cbFileCurr <= pTestFile->cbFileMax,
     256              ("Current file size (%llu) exceeds final size (%llu)\n",
     257              pTestFile->cbFileCurr, pTestFile->cbFileMax));
    241258
    242259    /* Allocate data buffer. */
     
    344361         * The minimum chance is 33 percent.
    345362         */
    346         iWriteChance = (int)(((float)100.0 / pTestFile->cbFileMax) * (float)pTestFile->cbFileCurr);
     363        iWriteChance = 100 - (int)(((float)100.0 / pTestFile->cbFileMax) * (float)pTestFile->cbFileCurr);
    347364        iWriteChance = RT_MAX(33, iWriteChance);
    348365
    349         /* Wait a random amount of time. (1ms - 10s) */
    350         RTThreadSleep(RTRandU32Ex(1, 10000));
     366        /* Wait a random amount of time. (1ms - 100ms) */
     367        RTThreadSleep(RTRandU32Ex(1, 100));
    351368    }
    352369
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