Changeset 23811 in vbox
- Timestamp:
- Oct 15, 2009 5:52:07 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53556
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp
r23713 r23811 83 83 #define SEGMENT_SIZE_MAX (TEST_PATTERN_SIZE) 84 84 /** Maximum number of active tasks. */ 85 #define TASK_ACTIVE_MAX ( 512)85 #define TASK_ACTIVE_MAX (1) 86 86 /** Maximum size of a transfer. */ 87 87 #define TASK_TRANSFER_SIZE_MAX (_1M) … … 168 168 { 169 169 size_t cbCompare; 170 unsigned iSeg = off / pTestFile->cbFileSegment; ;170 unsigned iSeg = off / pTestFile->cbFileSegment; 171 171 PPDMACTESTFILESEG pSeg = &pTestFile->paSegs[iSeg]; 172 172 uint8_t *pbTestPattern; … … 196 196 { 197 197 size_t cbFill; 198 unsigned iSeg = off / pTestFile->cbFileSegment; ;198 unsigned iSeg = off / pTestFile->cbFileSegment; 199 199 PPDMACTESTFILESEG pSeg = &pTestFile->paSegs[iSeg]; 200 200 uint8_t *pbTestPattern; … … 228 228 { 229 229 offMax = (pTestFile->cbFileMax - pTestFile->cbFileCurr) < pTestTask->DataSeg.cbSeg 230 ? pTestFile->cbFile Curr +pTestTask->DataSeg.cbSeg230 ? pTestFile->cbFileMax - pTestTask->DataSeg.cbSeg 231 231 : pTestFile->cbFileCurr; 232 232 } … … 234 234 offMax = pTestFile->cbFileMax - pTestTask->DataSeg.cbSeg; 235 235 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; 237 250 238 251 /* Set new file size of required */ 239 252 if ((uint64_t)pTestTask->off + pTestTask->DataSeg.cbSeg > pTestFile->cbFileCurr) 240 253 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)); 241 258 242 259 /* Allocate data buffer. */ … … 344 361 * The minimum chance is 33 percent. 345 362 */ 346 iWriteChance = (int)(((float)100.0 / pTestFile->cbFileMax) * (float)pTestFile->cbFileCurr);363 iWriteChance = 100 - (int)(((float)100.0 / pTestFile->cbFileMax) * (float)pTestFile->cbFileCurr); 347 364 iWriteChance = RT_MAX(33, iWriteChance); 348 365 349 /* Wait a random amount of time. (1ms - 10 s) */350 RTThreadSleep(RTRandU32Ex(1, 100 00));366 /* Wait a random amount of time. (1ms - 100ms) */ 367 RTThreadSleep(RTRandU32Ex(1, 100)); 351 368 } 352 369
Note:
See TracChangeset
for help on using the changeset viewer.