Changeset 22006 in vbox
- Timestamp:
- Aug 5, 2009 6:41:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstCompressionBenchmark.cpp
r21917 r22006 24 24 * Header Files * 25 25 *******************************************************************************/ 26 #include <iprt/asm.h> 26 27 #include <iprt/assert.h> 27 28 #include <iprt/crc.h> … … 264 265 265 266 g_pabDecompr = (uint8_t *)RTMemAlloc(g_cbPages); 266 g_cbComprAlloc = g_cbPages * 2;267 g_cbComprAlloc = RT_MAX(g_cbPages * 2, 256 * PAGE_SIZE); 267 268 g_pabCompr = (uint8_t *)RTMemAlloc(g_cbComprAlloc); 268 269 if (!g_pabSrc || !g_pabDecompr || !g_pabCompr) … … 309 310 if (RT_FAILURE(aTests[j].rc)) 310 311 continue; 311 memset(g_pabCompr, 0 , g_cbComprAlloc);312 memset(g_pabDecompr, 0 , g_cbPages);312 memset(g_pabCompr, 0xaa, g_cbComprAlloc); 313 memset(g_pabDecompr, 0xcc, g_cbPages); 313 314 g_cbCompr = 0; 314 315 g_offComprIn = 0; … … 318 319 * Compress it. 319 320 */ 320 uint64_t NanoTS= RTTimeNanoTS();321 uint64_t NanoTS = RTTimeNanoTS(); 321 322 if (aTests[j].fBlock) 322 323 { … … 326 327 for (size_t iPage = 0; iPage < g_cPages; iPage += cPagesAtATime) 327 328 { 328 AssertBreakStmt(cbLeft > PAGE_SIZE * 4, rc = VERR_BUFFER_OVERFLOW);329 AssertBreakStmt(cbLeft > PAGE_SIZE * 4, aTests[j].rc = rc = VERR_BUFFER_OVERFLOW); 329 330 uint32_t *pcb = (uint32_t *)pbDstPage; 330 331 pbDstPage += sizeof(uint32_t); … … 506 507 507 508 /* 509 * Count zero pages in the data set. 510 */ 511 size_t cZeroPages = 0; 512 for (size_t iPage = 0; iPage < g_cPages; iPage++) 513 { 514 if (!ASMMemIsAllU32(&g_pabSrc[iPage * PAGE_SIZE], PAGE_SIZE, 0)) 515 cZeroPages++; 516 } 517 RTPrintf(" %'10zu zero pages (%u %%)\n", cZeroPages, cZeroPages * 100 / g_cPages); 518 519 /* 508 520 * A little extension to the test, benchmark relevant CRCs. 509 521 */
Note:
See TracChangeset
for help on using the changeset viewer.