VirtualBox

Changeset 104095 in vbox


Ignore:
Timestamp:
Mar 27, 2024 3:46:10 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162496
Message:

VMM/IEM: Release statistics on how often the exec memory allocator fails to allocate a large enough instruction buffer, bugref:10370

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r104084 r104095  
    508508    AssertMsgReturn(cbReq > 32 && cbReq < _512K, ("%#x\n", cbReq), NULL);
    509509
     510    /*
     511     * Adjust the request size so it'll fit the allocator alignment/whatnot.
     512     *
     513     * For the RTHeapSimple allocator this means to follow the logic described
     514     * in iemExecMemAllocatorGrow and attempt to allocate it from one of the
     515     * existing chunks if we think we've got sufficient free memory around.
     516     *
     517     * While for the alternative one we just align it up to a whole unit size.
     518     */
     519#ifdef IEMEXECMEM_USE_ALT_SUB_ALLOCATOR
     520    cbReq = RT_ALIGN_32(cbReq, IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SIZE);
     521#else
     522    cbReq = RT_ALIGN_32(cbReq + pExecMemAllocator->cbHeapBlockHdr, 64) - pExecMemAllocator->cbHeapBlockHdr;
     523#endif
    510524
    511525    for (unsigned iIteration = 0;; iIteration++)
    512526    {
    513         /*
    514          * Adjust the request size so it'll fit the allocator alignment/whatnot.
    515          *
    516          * For the RTHeapSimple allocator this means to follow the logic described
    517          * in iemExecMemAllocatorGrow and attempt to allocate it from one of the
    518          * existing chunks if we think we've got sufficient free memory around.
    519          *
    520          * While for the alternative one we just align it up to a whole unit size.
    521          */
    522 #ifdef IEMEXECMEM_USE_ALT_SUB_ALLOCATOR
    523         cbReq = RT_ALIGN_32(cbReq, IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SIZE);
    524 #else
    525         cbReq = RT_ALIGN_32(cbReq + pExecMemAllocator->cbHeapBlockHdr, 64) - pExecMemAllocator->cbHeapBlockHdr;
    526 #endif
    527527        if (cbReq <= pExecMemAllocator->cbFree)
    528528        {
     
    565565        else
    566566        {
    567             /** @todo stats...   */
     567            STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeExecMemInstrBufAllocFailed);
    568568            return NULL;
    569569        }
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r104064 r104095  
    440440        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatCheckNeedCsLimChecking, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    441441                        "Needing CS.LIM checking TB after branch or on page crossing", "/IEM/CPU%u/re/CheckTbNeedCsLimChecking", idCpu);
     442
     443        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatNativeExecMemInstrBufAllocFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     444                        "Number of times the exec memory allocator failed to allocate a large enough buffer",
     445                        "/IEM/CPU%u/re/NativeExecMemInstrBufAllocFailed", idCpu);
    442446
    443447        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatNativeCallsRecompiled, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS_PER_TB,
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r104076 r104095  
    18531853    /** Statistics: Times a jump or page crossing required a TB with CS.LIM checking. */
    18541854    STAMCOUNTER             StatCheckNeedCsLimChecking;
     1855    /** Exec memory allocator statistics: Number of times allocaintg executable memory failed. */
     1856    STAMCOUNTER             StatNativeExecMemInstrBufAllocFailed;
    18551857    /** Native TB statistics: Number of fully recompiled TBs. */
    18561858    STAMCOUNTER             StatNativeFullyRecompiledTbs;
     
    19771979#endif
    19781980
    1979     uint64_t                au64Padding[5];
     1981    uint64_t                au64Padding[4];
    19801982    /** @} */
    19811983
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette