VirtualBox

Changeset 91263 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Sep 15, 2021 7:26:20 PM (3 years ago)
Author:
vboxsync
Message:

VMM/IEM: Moved instruction stats from the hyper heap and into the VM structure. bugref:10093

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

Legend:

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

    r91016 r91263  
    1241212412 */
    1241312413#ifdef VBOX_WITH_STATISTICS
    12414 # define IEMOP_INC_STATS(a_Stats) do { pVCpu->iem.s.CTX_SUFF(pStats)->a_Stats += 1; } while (0)
     12414# ifdef IN_RING3
     12415#  define IEMOP_INC_STATS(a_Stats) do { pVCpu->iem.s.StatsR3.a_Stats += 1; } while (0)
     12416# else
     12417#  define IEMOP_INC_STATS(a_Stats) do { pVCpu->iem.s.StatsRZ.a_Stats += 1; } while (0)
     12418# endif
    1241512419#else
    1241612420# define IEMOP_INC_STATS(a_Stats) do { } while (0)
     
    1410314107VMMDECL(VBOXSTRICTRC) IEMExecOne(PVMCPUCC pVCpu)
    1410414108{
     14109    AssertCompile(sizeof(pVCpu->iem.s) <= sizeof(pVCpu->iem.padding)); /* (tstVMStruct can't do it's job w/o instruction stats) */
    1410514110#ifdef LOG_ENABLED
    1410614111    iemLogCurInstr(pVCpu, true, "IEMExecOne");
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r82968 r91263  
    6767    {
    6868        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
     69        AssertCompile(sizeof(pVCpu->iem.s) <= sizeof(pVCpu->iem.padding)); /* (tstVMStruct can't do it's job w/o instruction stats) */
    6970
    7071        pVCpu->iem.s.CodeTlb.uTlbRevision = pVCpu->iem.s.DataTlb.uTlbRevision = uInitialTlbRevision;
     
    113114
    114115#if defined(VBOX_WITH_STATISTICS) && !defined(DOXYGEN_RUNNING)
    115         /* Allocate instruction statistics and register them. */
    116         pVCpu->iem.s.pStatsR3 = (PIEMINSTRSTATS)MMR3HeapAllocZ(pVM, MM_TAG_IEM, sizeof(IEMINSTRSTATS));
    117         AssertLogRelReturn(pVCpu->iem.s.pStatsR3, VERR_NO_MEMORY);
    118         int rc = MMHyperAlloc(pVM, sizeof(IEMINSTRSTATS), sizeof(uint64_t), MM_TAG_IEM, (void **)&pVCpu->iem.s.pStatsCCR3);
    119         AssertLogRelRCReturn(rc, rc);
    120         pVCpu->iem.s.pStatsR0 = MMHyperR3ToR0(pVM, pVCpu->iem.s.pStatsCCR3);
     116        /* Instruction statistics: */
    121117# define IEM_DO_INSTR_STAT(a_Name, a_szDesc) \
    122             STAMR3RegisterF(pVM, &pVCpu->iem.s.pStatsCCR3->a_Name, STAMTYPE_U32_RESET, STAMVISIBILITY_USED, \
     118            STAMR3RegisterF(pVM, &pVCpu->iem.s.StatsRZ.a_Name, STAMTYPE_U32_RESET, STAMVISIBILITY_USED, \
    123119                            STAMUNIT_COUNT, a_szDesc, "/IEM/CPU%u/instr-RZ/" #a_Name, idCpu); \
    124             STAMR3RegisterF(pVM, &pVCpu->iem.s.pStatsR3->a_Name, STAMTYPE_U32_RESET, STAMVISIBILITY_USED, \
     120            STAMR3RegisterF(pVM, &pVCpu->iem.s.StatsR3.a_Name, STAMTYPE_U32_RESET, STAMVISIBILITY_USED, \
    125121                            STAMUNIT_COUNT, a_szDesc, "/IEM/CPU%u/instr-R3/" #a_Name, idCpu);
    126122# include "IEMInstructionStatisticsTmpl.h"
     
    193189{
    194190    NOREF(pVM);
    195 #if defined(VBOX_WITH_STATISTICS) && !defined(DOXYGEN_RUNNING)
    196     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    197     {
    198         PVMCPU pVCpu = pVM->apCpusR3[idCpu];
    199         MMR3HeapFree(pVCpu->iem.s.pStatsR3);
    200         pVCpu->iem.s.pStatsR3 = NULL;
    201     }
    202 #endif
    203191    return VINF_SUCCESS;
    204192}
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r91016 r91263  
    612612    IEMTLB                  CodeTlb;
    613613
    614     /** Pointer to instruction statistics for ring-0 context. */
    615     R0PTRTYPE(PIEMINSTRSTATS) pStatsR0;
    616     /** Ring-3 pointer to instruction statistics for non-ring-3 code. */
    617     R3PTRTYPE(PIEMINSTRSTATS) pStatsCCR3;
    618     /** Pointer to instruction statistics for ring-3 context. */
    619     R3PTRTYPE(PIEMINSTRSTATS) pStatsR3;
     614#if defined(VBOX_WITH_STATISTICS) && !defined(IN_TSTVMSTRUCT) && !defined(DOXYGEN_RUNNING)
     615    /** Instruction statistics for ring-0/raw-mode. */
     616    IEMINSTRSTATS           StatsRZ;
     617    /** Instruction statistics for ring-3. */
     618    IEMINSTRSTATS           StatsR3;
     619#endif
    620620} IEMCPU;
    621621AssertCompileMemberOffset(IEMCPU, fCurXcpt, 0x48);
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