VirtualBox

Changeset 82928 in vbox for trunk


Ignore:
Timestamp:
Jan 30, 2020 1:52:30 PM (5 years ago)
Author:
vboxsync
Message:

tstMMHyperHeap: some tweaking.

File:
1 edited

Legend:

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

    r80334 r82928  
    3838#define NUM_CPUS  16
    3939
     40#define OUTPUT(a) do { Log(a); RTPrintf a; } while (0)
    4041
    4142/**
     
    182183
    183184    /* free and allocate the same node again. */
     185MMHyperHeapDump(pVM);
    184186    for (i = 0; i < RT_ELEMENTS(aOps); i++)
    185187    {
     
    187189            ||  aOps[i].uAlignment == PAGE_SIZE)
    188190            continue;
    189         //size_t cbBeforeSub = MMHyperHeapGetFreeSize(pVM);
     191        size_t cbBeforeSub = MMHyperHeapGetFreeSize(pVM);
    190192        rc = MMHyperFree(pVM, aOps[i].pvAlloc);
    191193        if (RT_FAILURE(rc))
     
    194196            return 1;
    195197        }
    196         //RTPrintf("debug: i=%d cbBeforeSub=%d now=%d\n", i, cbBeforeSub, MMHyperHeapGetFreeSize(pVM));
     198        size_t const cbFreed = MMHyperHeapGetFreeSize(pVM);
    197199        void *pv;
    198200        rc = MMHyperAlloc(pVM, aOps[i].cb, aOps[i].uAlignment, MM_TAG_VM_REQ, &pv);
     
    208210        }
    209211        aOps[i].pvAlloc = pv;
    210         #if 0 /* won't work :/ */
     212        OUTPUT(("debug: i=%02d cbBeforeSub=%d cbFreed=%d now=%d\n", i, cbBeforeSub, cbFreed, MMHyperHeapGetFreeSize(pVM)));
     213#if 0 /* won't work :/ */
    211214        size_t cbAfterSub = MMHyperHeapGetFreeSize(pVM);
    212215        if (cbBeforeSub != cbAfterSub)
     
    215218            return 1;
    216219        }
    217         #endif
     220#endif
    218221    }
    219222
     
    228231                ||  !aOps[j].pvAlloc)
    229232                continue;
    230             RTPrintf("j=%d i=%d free=%d cb=%d pv=%p\n", j, i, MMHyperHeapGetFreeSize(pVM), aOps[j].cb, aOps[j].pvAlloc);
     233            OUTPUT(("j=%02d i=%02d free=%d cb=%5u pv=%p\n", j, i, MMHyperHeapGetFreeSize(pVM), aOps[j].cb, aOps[j].pvAlloc));
    231234            if (aOps[j].uAlignment == PAGE_SIZE)
    232235                cbBefore -= aOps[j].cb;
     
    245248    }
    246249    Assert(cFreed == RT_ELEMENTS(aOps));
    247     RTPrintf("i=done free=%d\n", MMHyperHeapGetFreeSize(pVM));
     250    OUTPUT(("i=done free=%d\n", MMHyperHeapGetFreeSize(pVM)));
    248251
    249252    /* check that we're back at the right amount of free memory. */
     
    251254    if (cbBefore != cbAfter)
    252255    {
    253         RTPrintf("Warning: Either we've split out an alignment chunk at the start, or we've got\n"
    254                  "         an alloc/free accounting bug: cbBefore=%d cbAfter=%d\n", cbBefore, cbAfter);
     256        OUTPUT(("Warning: Either we've split out an alignment chunk at the start, or we've got\n"
     257                "         an alloc/free accounting bug: cbBefore=%d cbAfter=%d\n", cbBefore, cbAfter));
    255258#ifdef DEBUG
    256259        MMHyperHeapDump(pVM);
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