- Timestamp:
- Mar 28, 2019 1:34:31 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
r77928 r77931 2216 2216 2217 2217 /** Thread receiving the bytes from a splice() call. */ 2218 static DECLCALLBACK(int) fsPerfSplice RecvThread(RTTHREAD hSelf, void *pvUser)2218 static DECLCALLBACK(int) fsPerfSpliceToPipeThread(RTTHREAD hSelf, void *pvUser) 2219 2219 { 2220 2220 FSPERFSPLICEARGS *pArgs = (FSPERFSPLICEARGS *)pvUser; … … 2258 2258 2259 2259 /** Sends hFile1 to a pipe via the Linux-specific splice() syscall. */ 2260 static uint64_t fsPerfSplice SendFile(FSPERFSPLICEARGS *pArgs, RTFILE hFile1, uint64_t offFile,2261 size_t cbSend, uint64_t cbSent, uint8_t bFiller, bool fCheckBuf, unsigned iLine)2260 static uint64_t fsPerfSpliceToPipeOne(FSPERFSPLICEARGS *pArgs, RTFILE hFile1, uint64_t offFile, 2261 size_t cbSend, uint64_t cbSent, uint8_t bFiller, bool fCheckBuf, unsigned iLine) 2262 2262 { 2263 2263 /* Copy parameters to the argument structure: */ … … 2276 2276 int rc; 2277 2277 RTTHREAD hThread = NIL_RTTHREAD; 2278 RTTESTI_CHECK_RC(rc = RTThreadCreate(&hThread, fsPerfSplice RecvThread, pArgs, 0,2278 RTTESTI_CHECK_RC(rc = RTThreadCreate(&hThread, fsPerfSpliceToPipeThread, pArgs, 0, 2279 2279 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "splicerecv"), VINF_SUCCESS); 2280 2280 if (RT_SUCCESS(rc)) … … 2291 2291 if (RT_UNLIKELY(cbActual < 0)) 2292 2292 { 2293 if (iErr == EPIPE && cbTotal == pArgs->cbSent) 2294 break; 2293 2295 RTTestIFailed("%u: splice(file, &%#RX64, pipe, NULL, %#zx, 0) failed (%zd): %d (%Rrc), offFileIn=%#RX64\n", 2294 2296 iLine, offFile, cbLeft, cbActual, iErr, RTErrConvertFromErrno(iErr), (uint64_t)offFileIn); … … 2360 2362 * First iteration with default buffer content. 2361 2363 */ 2362 fsPerfSplice SendFile(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, true /*fCheckBuf*/, __LINE__);2364 fsPerfSpliceToPipeOne(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, true /*fCheckBuf*/, __LINE__); 2363 2365 if (cbFileMax == cbFile) 2364 fsPerfSplice SendFile(&Args, hFile1, 63, cbFileMax, cbFileMax - 63, 0xf6, true /*fCheckBuf*/, __LINE__);2366 fsPerfSpliceToPipeOne(&Args, hFile1, 63, cbFileMax, cbFileMax - 63, 0xf6, true /*fCheckBuf*/, __LINE__); 2365 2367 else 2366 fsPerfSplice SendFile(&Args, hFile1, 63, cbFileMax - 63, cbFileMax - 63, 0xf6, true /*fCheckBuf*/, __LINE__);2368 fsPerfSpliceToPipeOne(&Args, hFile1, 63, cbFileMax - 63, cbFileMax - 63, 0xf6, true /*fCheckBuf*/, __LINE__); 2367 2369 2368 2370 /* … … 2374 2376 do 2375 2377 { 2376 fsPerfSplice SendFile(&Args, hFile1, 0, cbToSend, cbToSend, bFiller, true /*fCheckBuf*/, __LINE__); /* prime cache */2378 fsPerfSpliceToPipeOne(&Args, hFile1, 0, cbToSend, cbToSend, bFiller, true /*fCheckBuf*/, __LINE__); /* prime cache */ 2377 2379 2378 2380 bFiller += 1; … … 2380 2382 RTTESTI_CHECK_RC(RTFileWriteAt(hFile1, 0, Args.pbBuf, cbToSend, NULL), VINF_SUCCESS); 2381 2383 2382 fsPerfSplice SendFile(&Args, hFile1, 0, cbToSend, cbToSend, bFiller, true /*fCheckBuf*/, __LINE__);2384 fsPerfSpliceToPipeOne(&Args, hFile1, 0, cbToSend, cbToSend, bFiller, true /*fCheckBuf*/, __LINE__); 2383 2385 2384 2386 cbToSend /= 2; … … 2402 2404 uint64_t const cbSent = offToSendFrom + cbToSend <= cbFile ? cbToSend : cbFile - offToSendFrom; 2403 2405 2404 fsPerfSplice SendFile(&Args, hFile1, offToSendFrom, cbToSend, cbSent, bFiller, true /*fCheckBuf*/, __LINE__);2406 fsPerfSpliceToPipeOne(&Args, hFile1, offToSendFrom, cbToSend, cbSent, bFiller, true /*fCheckBuf*/, __LINE__); 2405 2407 } 2406 2408 … … 2413 2415 for (;;) 2414 2416 { 2415 uint64_t cNsThis = fsPerfSplice SendFile(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, false /*fCheckBuf*/, __LINE__);2417 uint64_t cNsThis = fsPerfSpliceToPipeOne(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, false /*fCheckBuf*/, __LINE__); 2416 2418 nsElapsed += cNsThis; 2417 2419 cIterations++; … … 2437 2439 2438 2440 /** Thread sending the bytes to a splice() call. */ 2439 static DECLCALLBACK(int) fsPerfSplice SendThread(RTTHREAD hSelf, void *pvUser)2441 static DECLCALLBACK(int) fsPerfSpliceToFileThread(RTTHREAD hSelf, void *pvUser) 2440 2442 { 2441 2443 FSPERFSPLICEARGS *pArgs = (FSPERFSPLICEARGS *)pvUser; … … 2464 2466 2465 2467 /** Fill hFile1 via a pipe and the Linux-specific splice() syscall. */ 2466 static uint64_t fsPerfSplice WriteFile(FSPERFSPLICEARGS *pArgs, RTFILE hFile1, uint64_t offFile,2468 static uint64_t fsPerfSpliceToFileOne(FSPERFSPLICEARGS *pArgs, RTFILE hFile1, uint64_t offFile, 2467 2469 size_t cbSend, uint64_t cbSent, uint8_t bFiller, bool fCheckFile, unsigned iLine) 2468 2470 { … … 2482 2484 int rc; 2483 2485 RTTHREAD hThread = NIL_RTTHREAD; 2484 RTTESTI_CHECK_RC(rc = RTThreadCreate(&hThread, fsPerfSplice SendThread, pArgs, 0,2486 RTTESTI_CHECK_RC(rc = RTThreadCreate(&hThread, fsPerfSpliceToFileThread, pArgs, 0, 2485 2487 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "splicerecv"), VINF_SUCCESS); 2486 2488 if (RT_SUCCESS(rc)) … … 2585 2587 */ 2586 2588 uint8_t bFiller = 0x76; 2587 fsPerfSplice WriteFile(&Args, hFile1, 0, cbFileMax, cbFileMax, bFiller, true /*fCheckFile*/, __LINE__);2589 fsPerfSpliceToFileOne(&Args, hFile1, 0, cbFileMax, cbFileMax, bFiller, true /*fCheckFile*/, __LINE__); 2588 2590 2589 2591 /* … … 2598 2600 2599 2601 bFiller++; 2600 fsPerfSplice WriteFile(&Args, hFile1, offToWriteAt, cbTryRead, cbToWrite, bFiller, true /*fCheckFile*/, __LINE__);2602 fsPerfSpliceToFileOne(&Args, hFile1, offToWriteAt, cbTryRead, cbToWrite, bFiller, true /*fCheckFile*/, __LINE__); 2601 2603 } 2602 2604 … … 2609 2611 for (;;) 2610 2612 { 2611 uint64_t cNsThis = fsPerfSplice WriteFile(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, false /*fCheckBuf*/, __LINE__);2613 uint64_t cNsThis = fsPerfSpliceToFileOne(&Args, hFile1, 0, cbFileMax, cbFileMax, 0xf6, false /*fCheckBuf*/, __LINE__); 2612 2614 nsElapsed += cNsThis; 2613 2615 cIterations++;
Note:
See TracChangeset
for help on using the changeset viewer.