VirtualBox

Changeset 104361 in vbox


Ignore:
Timestamp:
Apr 18, 2024 2:34:59 PM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Moved the native TB exit statistics on g_aSimpleTailLabels to the helper functions and made them release stats. Eliminate two duplicate stats. bugref:10653

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

Legend:

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

    r104343 r104361  
    135135IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseDe,(PVMCPUCC pVCpu))
    136136{
     137    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseDe);
    137138    iemRaiseDivideErrorJmp(pVCpu);
    138139#ifndef _MSC_VER
     
    147148IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseUd,(PVMCPUCC pVCpu))
    148149{
     150    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseUd);
    149151    iemRaiseUndefinedOpcodeJmp(pVCpu);
    150152#ifndef _MSC_VER
     
    161163IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseSseRelated,(PVMCPUCC pVCpu))
    162164{
     165    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseSseRelated);
    163166    if (   (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM)
    164167        || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR))
     
    179182IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseAvxRelated,(PVMCPUCC pVCpu))
    180183{
     184    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseAvxRelated);
    181185    if (   (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) != (XSAVE_C_YMM | XSAVE_C_SSE)
    182186        || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE))
     
    197201IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseSseAvxFpRelated,(PVMCPUCC pVCpu))
    198202{
     203    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseSseAvxFpRelated);
    199204    if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT)
    200205        iemRaiseSimdFpExceptionJmp(pVCpu);
     
    212217IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseNm,(PVMCPUCC pVCpu))
    213218{
     219    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseNm);
    214220    iemRaiseDeviceNotAvailableJmp(pVCpu);
    215221#ifndef _MSC_VER
     
    224230IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseGp0,(PVMCPUCC pVCpu))
    225231{
     232    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseGp0);
    226233    iemRaiseGeneralProtectionFault0Jmp(pVCpu);
    227234#ifndef _MSC_VER
     
    236243IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseMf,(PVMCPUCC pVCpu))
    237244{
     245    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseMf);
    238246    iemRaiseMathFaultJmp(pVCpu);
    239247#ifndef _MSC_VER
     
    248256IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseXf,(PVMCPUCC pVCpu))
    249257{
     258    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitRaiseXf);
    250259    iemRaiseSimdFpExceptionJmp(pVCpu);
    251260#ifndef _MSC_VER
     
    266275       that return path codes via the native code generated for the TB. */
    267276    Log7(("TB obsolete: %p at %04x:%08RX64\n", pVCpu->iem.s.pCurTbR3, pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip));
     277    STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatNativeTbExitObsoleteTb);
    268278    iemThreadedTbObsolete(pVCpu, pVCpu->iem.s.pCurTbR3, false /*fSafeToFree*/);
    269279    return VINF_IEM_REEXEC_BREAK;
     
    61736183
    61746184#ifdef VBOX_WITH_STATISTICS
     6185
    61756186/**
    61766187 * Emits code to update the thread call statistics.
     
    62116222    return off;
    62126223}
     6224
    62136225#endif /* VBOX_WITH_STATISTICS */
    6214 
    62156226
    62166227/**
     
    92769287        {
    92779288            IEMNATIVELABELTYPE              enmLabel;
    9278             uint32_t                        offVCpuStats;
    92799289            PFNIEMNATIVESIMPLETAILLABELCALL pfnCallback;
    92809290        } const g_aSimpleTailLabels[] =
    92819291        {
    9282             {   kIemNativeLabelType_Invalid,                0, NULL },
    9283             {   kIemNativeLabelType_RaiseDe,                RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseDe),               iemNativeHlpExecRaiseDe },
    9284             {   kIemNativeLabelType_RaiseUd,                RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseUd),               iemNativeHlpExecRaiseUd },
    9285             {   kIemNativeLabelType_RaiseSseRelated,        RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseSseRelated),       iemNativeHlpExecRaiseSseRelated },
    9286             {   kIemNativeLabelType_RaiseAvxRelated,        RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseAvxRelated),       iemNativeHlpExecRaiseAvxRelated },
    9287             {   kIemNativeLabelType_RaiseSseAvxFpRelated,   RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseSseAvxFpRelated),  iemNativeHlpExecRaiseSseAvxFpRelated },
    9288             {   kIemNativeLabelType_RaiseNm,                RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseNm),               iemNativeHlpExecRaiseNm },
    9289             {   kIemNativeLabelType_RaiseGp0,               RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseGp0),              iemNativeHlpExecRaiseGp0 },
    9290             {   kIemNativeLabelType_RaiseMf,                RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseMf),               iemNativeHlpExecRaiseMf },
    9291             {   kIemNativeLabelType_RaiseXf,                RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitRaiseXf),               iemNativeHlpExecRaiseXf },
    9292             {   kIemNativeLabelType_ObsoleteTb,             RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitObsoleteTb),            iemNativeHlpObsoleteTb },
    9293             {   kIemNativeLabelType_NeedCsLimChecking,      RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitNeedCsLimChecking),     iemNativeHlpNeedCsLimChecking },
    9294             {   kIemNativeLabelType_CheckBranchMiss,        RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitCheckBranchMiss),       iemNativeHlpCheckBranchMiss },
     9292            {   kIemNativeLabelType_Invalid,                NULL },
     9293            {   kIemNativeLabelType_RaiseDe,                iemNativeHlpExecRaiseDe },
     9294            {   kIemNativeLabelType_RaiseUd,                iemNativeHlpExecRaiseUd },
     9295            {   kIemNativeLabelType_RaiseSseRelated,        iemNativeHlpExecRaiseSseRelated },
     9296            {   kIemNativeLabelType_RaiseAvxRelated,        iemNativeHlpExecRaiseAvxRelated },
     9297            {   kIemNativeLabelType_RaiseSseAvxFpRelated,   iemNativeHlpExecRaiseSseAvxFpRelated },
     9298            {   kIemNativeLabelType_RaiseNm,                iemNativeHlpExecRaiseNm },
     9299            {   kIemNativeLabelType_RaiseGp0,               iemNativeHlpExecRaiseGp0 },
     9300            {   kIemNativeLabelType_RaiseMf,                iemNativeHlpExecRaiseMf },
     9301            {   kIemNativeLabelType_RaiseXf,                iemNativeHlpExecRaiseXf },
     9302            {   kIemNativeLabelType_ObsoleteTb,             iemNativeHlpObsoleteTb },
     9303            {   kIemNativeLabelType_NeedCsLimChecking,      iemNativeHlpNeedCsLimChecking },
     9304            {   kIemNativeLabelType_CheckBranchMiss,        iemNativeHlpCheckBranchMiss },
    92959305        };
     9306
    92969307        AssertCompile(RT_ELEMENTS(g_aSimpleTailLabels) == (unsigned)kIemNativeLabelType_LastSimple + 1U);
    92979308        AssertCompile(kIemNativeLabelType_Invalid == 0);
     
    93109321                {
    93119322                    iemNativeLabelDefine(pReNative, idxLabel, off);
    9312 
    9313 #ifdef VBOX_WITH_STATISTICS
    9314                     off = iemNativeEmitNativeTbExitStats(pReNative, off, g_aSimpleTailLabels[enmLabel].offVCpuStats);
    9315 #endif
    93169323
    93179324                    /* int pfnCallback(PVMCPUCC pVCpu) */
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r104357 r104361  
    569569        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativePcUpdateDelayed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Delayed RIP updates", "/IEM/CPU%u/re/NativePcUpdateDelayed", idCpu);
    570570
    571 #ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
     571#   ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
    572572        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeSimdRegFindFree, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    573573                        "Number of calls to iemNativeSimdRegAllocFindFree.",
     
    603603        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeMaybeAvxXcptCheckOmitted,              STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() checks omitted",
    604604                        "/IEM/CPU%u/re/NativeMaybeAvxXcptCheckOmitted", idCpu);
    605 #endif
     605#   endif
    606606
    607607        /* Ratio of the status bit skippables. */
     
    618618        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeTbExitReturnWithFlags, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    619619                        "Number of times the TB finished through the ReturnWithFlags label", "/IEM/CPU%u/re/NativeTbExitReturnWithFlags", idCpu);
     620#  endif /* VBOX_WITH_STATISTICS */
    620621        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeTbExitObsoleteTb, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    621622                        "Number of times the TB finished through the ObsoleteTb label", "/IEM/CPU%u/re/NativeTbExitObsoleteTb", idCpu);
    622         STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeTbExitNeedCsLimChecking, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     623        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatCheckNeedCsLimChecking, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    623624                        "Number of times the TB finished through the NeedCsLimChecking label", "/IEM/CPU%u/re/NativeTbExitNeedCsLimChecking", idCpu);
    624         STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeTbExitCheckBranchMiss, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     625        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatCheckBranchMisses, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    625626                        "Number of times the TB finished through the CheckBranchMiss label", "/IEM/CPU%u/re/NativeTbExitCheckBranchMiss", idCpu);
    626627        STAMR3RegisterF(pVM, &pVCpu->iem.s.StatNativeTbExitRaiseDe, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     
    643644                        "Number of times the TB finished raising a #XF exception", "/IEM/CPU%u/re/NativeTbExitRaiseXf", idCpu);
    644645
    645 #  endif /* VBOX_WITH_STATISTICS */
    646646# endif /* VBOX_WITH_IEM_NATIVE_RECOMPILER */
    647647
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r104357 r104361  
    20472047    /** Native recompiler: The TB finished executing jumping to the ReturnWithFlags label. */
    20482048    STAMCOUNTER             StatNativeTbExitReturnWithFlags;
     2049
    20492050    /** Native recompiler: The TB finished executing jumping to the RaiseDe label. */
    20502051    STAMCOUNTER             StatNativeTbExitRaiseDe;
     
    20672068    /** Native recompiler: The TB finished executing jumping to the ObsoleteTb label. */
    20682069    STAMCOUNTER             StatNativeTbExitObsoleteTb;
    2069     /** Native recompiler: The TB finished executing jumping to the NeedCsLimChecking label. */
    2070     STAMCOUNTER             StatNativeTbExitNeedCsLimChecking;
    2071     /** Native recompiler: The TB finished executing jumping to the CheckBranchMiss label. */
    2072     STAMCOUNTER             StatNativeTbExitCheckBranchMiss;
    2073 
    2074     uint64_t                au64Padding[3];
     2070
     2071    uint64_t                au64Padding[5];
    20752072    /** @} */
    20762073
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