VirtualBox

Changeset 100803 in vbox


Ignore:
Timestamp:
Aug 4, 2023 10:04:07 PM (16 months ago)
Author:
vboxsync
Message:

VMM/IEM: More stats. bugref:10369

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

Legend:

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

    r100802 r100803  
    9191
    9292/**
    93  * Built-in function that checks for pending interrupts that can be delivered.
     93 * Built-in function that checks for pending interrupts that can be delivered or
     94 * forced action flags.
    9495 *
    9596 * This triggers after the completion of an instruction, so EIP is already at
     
    120121         pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.eip, fCpu,
    121122         pVCpu->CTX_SUFF(pVM)->fGlobalForcedActions & VM_FF_ALL_MASK, pVCpu->cpum.GstCtx.rflags.Bits.u1IF));
     123    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckIrqBreaks);
    122124    return VINF_IEM_REEXEC_BREAK;
    123125}
     
    139141             fExpectedExec, pVCpu->iem.s.fExec, fExpectedExec ^ pVCpu->iem.s.fExec));
    140142    RT_NOREF(uParam1, uParam2);
     143    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckModeBreaks);
    141144    return VINF_IEM_REEXEC_BREAK;
    142145}
     
    245248                      pVCpu->iem.s.GCPhysInstrBuf + off, GCPhysRangePageWithOffset, pVCpu->iem.s.pbInstrBuf, __LINE__)); \
    246249                RT_NOREF(a_cbInstr); \
     250                STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckBranchMisses); \
    247251                return VINF_IEM_REEXEC_BREAK; \
    248252            } \
     
    278282                      pVCpu->iem.s.GCPhysInstrBuf + offNew, GCPhysRangePageWithOffset, pVCpu->iem.s.pbInstrBuf, __LINE__)); \
    279283                RT_NOREF(a_cbInstr); \
     284                STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckBranchMisses); \
    280285                return VINF_IEM_REEXEC_BREAK; \
    281286            } \
     
    311316                  pVCpu->iem.s.GCPhysInstrBuf + off, GCPhysRangePageWithOffset, pVCpu->iem.s.pbInstrBuf, __LINE__)); \
    312317            RT_NOREF(a_cbInstr); \
     318            STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckBranchMisses); \
    313319            return VINF_IEM_REEXEC_BREAK; \
    314320        } \
     
    331337                  pVCpu->cpum.GstCtx.cs.u32Limit, pVCpu->cpum.GstCtx.cs.u64Base, __LINE__)); \
    332338            RT_NOREF(a_pTb, a_cbInstr); \
     339            STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckNeedCsLimChecking); \
    333340            return VINF_IEM_REEXEC_BREAK; \
    334341        } \
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp

    r100801 r100803  
    910910
    911911    PIEMTHRDEDCALLENTRY const pCall     = &pTb->Thrd.paCalls[pTb->Thrd.cCalls];
     912    pCall->idxInstr    = pTb->cInstructions;
    912913    pCall->offOpcode   = offOpcode;
    913914    pCall->idxRange    = idxRange;
     
    12721273        pTb->Thrd.cCalls = (uint16_t)(idxCall + 1);
    12731274        pCall->enmFunction = kIemThreadedFunc_BltIn_CheckIrq;
     1275        pCall->idxInstr    = pTb->cInstructions;
    12741276        pCall->uUnused0    = 0;
    12751277        pCall->offOpcode   = 0;
     
    13251327    PIEMTHRDEDCALLENTRY pCall = &pTb->Thrd.paCalls[pTb->Thrd.cCalls++];
    13261328    pCall->enmFunction = kIemThreadedFunc_BltIn_CheckIrq;
     1329    pCall->idxInstr    = pTb->cInstructions;
    13271330    pCall->uUnused0    = 0;
    13281331    pCall->offOpcode   = 0;
     
    14971500            iemThreadedLogCurInstr(pVCpu, "EX");
    14981501        }
    1499         Log9(("%04x:%08RX64: #%d - %d %s\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip,
    1500               pTb->Thrd.cCalls - cCallsLeft - 1, pCallEntry->enmFunction, g_apszIemThreadedFunctions[pCallEntry->enmFunction]));
     1502        Log9(("%04x:%08RX64: #%d/%d - %d %s\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip,
     1503              pTb->Thrd.cCalls - cCallsLeft - 1, pCallEntry->idxInstr, pCallEntry->enmFunction,
     1504              g_apszIemThreadedFunctions[pCallEntry->enmFunction]));
    15011505#endif
    15021506        VBOXSTRICTRC const rcStrict = g_apfnIemThreadedFunctions[pCallEntry->enmFunction](pVCpu,
     
    15091513        else
    15101514        {
    1511             pVCpu->iem.s.pCurTbR3 = NULL;
     1515            pVCpu->iem.s.cInstructions += pCallEntry->idxInstr; /* This may be one short, but better than zero. */
     1516            pVCpu->iem.s.pCurTbR3       = NULL;
     1517            STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatTbExecBreaks);
    15121518
    15131519            /* Some status codes are just to get us out of this loop and
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdTables.h

    r100788 r100803  
    207207            return VINF_IEM_RECOMPILE_END_TB; \
    208208        \
     209        uint8_t const idxInstrMc2 = pTb->cInstructions; \
    209210        do { } while (0)
    210211#define IEM_MC2_EMIT_CALL_0(a_enmFunction) do { \
     
    213214        PIEMTHRDEDCALLENTRY const pCall = &pTb->Thrd.paCalls[pTb->Thrd.cCalls++]; \
    214215        pCall->enmFunction = a_enmFunction; \
     216        pCall->idxInstr    = idxInstrMc2; \
     217        pCall->uUnused0    = 0; \
    215218        pCall->offOpcode   = offOpcodeMc2; \
    216219        pCall->cbOpcode    = cbInstrMc2; \
     
    226229        PIEMTHRDEDCALLENTRY const pCall = &pTb->Thrd.paCalls[pTb->Thrd.cCalls++]; \
    227230        pCall->enmFunction = a_enmFunction; \
     231        pCall->idxInstr    = idxInstrMc2; \
     232        pCall->uUnused0    = 0; \
    228233        pCall->offOpcode   = offOpcodeMc2; \
    229234        pCall->cbOpcode    = cbInstrMc2; \
     
    240245        PIEMTHRDEDCALLENTRY const pCall = &pTb->Thrd.paCalls[pTb->Thrd.cCalls++]; \
    241246        pCall->enmFunction = a_enmFunction; \
     247        pCall->idxInstr    = idxInstrMc2; \
     248        pCall->uUnused0    = 0; \
    242249        pCall->offOpcode   = offOpcodeMc2; \
    243250        pCall->cbOpcode    = cbInstrMc2; \
     
    255262        PIEMTHRDEDCALLENTRY const pCall = &pTb->Thrd.paCalls[pTb->Thrd.cCalls++]; \
    256263        pCall->enmFunction = a_enmFunction; \
     264        pCall->idxInstr    = idxInstrMc2; \
     265        pCall->uUnused0    = 0; \
    257266        pCall->offOpcode   = offOpcodeMc2; \
    258267        pCall->cbOpcode    = cbInstrMc2; \
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r100695 r100803  
    170170#ifdef VBOX_WITH_IEM_RECOMPILER
    171171        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbExec,             STAMTYPE_U64_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
    172                         "Executed translation block",                   "/IEM/CPU%u/cTbExec", idCpu);
     172                        "Executed translation block",                   "/IEM/CPU%u/re/cTbExec", idCpu);
     173        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTbExecBreaks,    STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
     174                        "Times TB execution was interrupted/broken off", "/IEM/CPU%u/re/cTbExecBreaks", idCpu);
    173175        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbAllocs,           STAMTYPE_U64,       STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
    174                         "Translation block allocations",                "/IEM/CPU%u/cTbAllocs", idCpu);
     176                        "Translation block allocations",                "/IEM/CPU%u/re/cTbAllocs", idCpu);
    175177        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbFrees,            STAMTYPE_U64,       STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
    176                         "Translation block frees",                      "/IEM/CPU%u/cTbFrees", idCpu);
     178                        "Translation block frees",                      "/IEM/CPU%u/re/cTbFrees", idCpu);
    177179        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbLookupHits,       STAMTYPE_U64_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
    178                         "Translation block lookup hits",                "/IEM/CPU%u/cTbLookupHits", idCpu);
     180                        "Translation block lookup hits",                "/IEM/CPU%u/re/cTbLookupHits", idCpu);
    179181        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbLookupMisses,     STAMTYPE_U64_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,
    180                         "Translation block lookup misses",              "/IEM/CPU%u/cTbLookupMisses", idCpu);
     182                        "Translation block lookup misses",              "/IEM/CPU%u/re/cTbLookupMisses", idCpu);
    181183
    182184        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTbThreadedCalls, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS_PER_TB,
    183                         "Calls per threaded translation block",         "/IEM/CPU%u/ThrdCallsPerTb", idCpu);
     185                        "Calls per threaded translation block",         "/IEM/CPU%u/re/ThrdCallsPerTb", idCpu);
    184186        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTbThreadedInstr, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_INSTR_PER_TB,
    185                         "Instruction per threaded translation block",   "/IEM/CPU%u/ThrdInstrPerTb", idCpu);
     187                        "Instruction per threaded translation block",   "/IEM/CPU%u/re/ThrdInstrPerTb", idCpu);
     188
     189        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatCheckIrqBreaks,  STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     190                        "TB breaks by CheckIrq",                        "/IEM/CPU%u/re/CheckIrqBreaks", idCpu);
     191        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatCheckModeBreaks, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     192                        "TB breaks by CheckMode",                       "/IEM/CPU%u/re/CheckModeBreaks", idCpu);
     193        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatCheckBranchMisses, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     194                        "Branch target misses",                         "/IEM/CPU%u/re/CheckTbJmpMisses", idCpu);
     195        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatCheckNeedCsLimChecking, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     196                        "Needing CS.LIM checking TB after branch or on page crossing", "/IEM/CPU%u/re/CheckTbNeedCsLimChecking", idCpu);
    186197#endif
    187198
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r100801 r100803  
    734734    /** The function to call (IEMTHREADEDFUNCS). */
    735735    uint16_t    enmFunction;
    736     uint16_t    uUnused0;
     736    /** Instruction number in the TB (for statistics). */
     737    uint8_t     idxInstr;
     738    uint8_t     uUnused0;
    737739
    738740    /** Offset into IEMTB::pabOpcodes. */
     
    11961198    uint64_t                GCVirtTbBranchSrcBuf;
    11971199    /* Alignment. */
    1198     uint64_t                au64RecompilerStuff2[5];
     1200    /** Statistics: Times TB execution was broken off before reaching the end. */
     1201    STAMCOUNTER             StatTbExecBreaks;
     1202    /** Statistics: Times BltIn_CheckIrq breaks out of the TB. */
     1203    STAMCOUNTER             StatCheckIrqBreaks;
     1204    /** Statistics: Times BltIn_CheckMode breaks out of the TB. */
     1205    STAMCOUNTER             StatCheckModeBreaks;
     1206    /** Statistics: Times a post jump target check missed and had to find new TB. */
     1207    STAMCOUNTER             StatCheckBranchMisses;
     1208    /** Statistics: Times a jump or page crossing required a TB with CS.LIM checking. */
     1209    STAMCOUNTER             StatCheckNeedCsLimChecking;
    11991210    /** Threaded TB statistics: Number of instructions per TB. */
    12001211    STAMPROFILE             StatTbThreadedInstr;
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