VirtualBox

Changeset 22006 in vbox


Ignore:
Timestamp:
Aug 5, 2009 6:41:29 PM (15 years ago)
Author:
vboxsync
Message:

tstCompressionBenchmark: More tests.

File:
1 edited

Legend:

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

    r21917 r22006  
    2424*   Header Files                                                               *
    2525*******************************************************************************/
     26#include <iprt/asm.h>
    2627#include <iprt/assert.h>
    2728#include <iprt/crc.h>
     
    264265
    265266    g_pabDecompr = (uint8_t *)RTMemAlloc(g_cbPages);
    266     g_cbComprAlloc = g_cbPages * 2;
     267    g_cbComprAlloc = RT_MAX(g_cbPages * 2, 256 * PAGE_SIZE);
    267268    g_pabCompr   = (uint8_t *)RTMemAlloc(g_cbComprAlloc);
    268269    if (!g_pabSrc || !g_pabDecompr || !g_pabCompr)
     
    309310            if (RT_FAILURE(aTests[j].rc))
    310311                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);
    313314            g_cbCompr = 0;
    314315            g_offComprIn = 0;
     
    318319             * Compress it.
    319320             */
    320             uint64_t        NanoTS    = RTTimeNanoTS();
     321            uint64_t NanoTS = RTTimeNanoTS();
    321322            if (aTests[j].fBlock)
    322323            {
     
    326327                for (size_t iPage = 0; iPage < g_cPages; iPage += cPagesAtATime)
    327328                {
    328                     AssertBreakStmt(cbLeft > PAGE_SIZE * 4, rc = VERR_BUFFER_OVERFLOW);
     329                    AssertBreakStmt(cbLeft > PAGE_SIZE * 4, aTests[j].rc = rc = VERR_BUFFER_OVERFLOW);
    329330                    uint32_t *pcb = (uint32_t *)pbDstPage;
    330331                    pbDstPage    += sizeof(uint32_t);
     
    506507
    507508    /*
     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    /*
    508520     * A little extension to the test, benchmark relevant CRCs.
    509521     */
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