VirtualBox

Changeset 72582 in vbox for trunk


Ignore:
Timestamp:
Jun 16, 2018 4:55:15 PM (7 years ago)
Author:
vboxsync
Message:

EM: More statistics for the history execution and probing. bugref:9044

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

Legend:

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

    r72580 r72582  
    419419            break;
    420420
    421         /* Only status codes that EMHandleRCTmpl.h will resume EMHistoryExec with. */
     421        /*
     422         * Only status codes that EMHandleRCTmpl.h will resume EMHistoryExec with.
     423         */
    422424        case VINF_IOM_R3_IOPORT_READ:           /* -> emR3ExecuteIOInstruction */
    423425        case VINF_IOM_R3_IOPORT_WRITE:          /* -> emR3ExecuteIOInstruction */
     
    465467        case EMEXITACTION_EXEC_WITH_MAX:
    466468        {
     469            STAM_REL_PROFILE_START(&pVCpu->em.s.StatHistoryExec, a);
    467470            LogFlow(("EMHistoryExec/EXEC_WITH_MAX: %RX64, max %u\n", pExitRec->uFlatPC, pExitRec->cMaxInstructionsWithoutExit));
    468471            VBOXSTRICTRC rcStrict = IEMExecForExits(pVCpu, fWillExit,
     
    474477                     VBOXSTRICTRC_VAL(rcStrict), ExecStats.cExits, ExecStats.cMaxExitDistance, ExecStats.cInstructions));
    475478            emHistoryExecSetContinueExitRecIdx(pVCpu, rcStrict, pExitRec);
     479            if (ExecStats.cExits > 1)
     480                STAM_REL_COUNTER_ADD(&pVCpu->em.s.StatHistoryExecSavedExits, ExecStats.cExits - 1);
     481            STAM_REL_COUNTER_ADD(&pVCpu->em.s.StatHistoryExecInstructions, ExecStats.cInstructions);
     482            STAM_REL_PROFILE_STOP(&pVCpu->em.s.StatHistoryExec, a);
    476483            return rcStrict;
    477484        }
     
    482489        case EMEXITACTION_EXEC_PROBE:
    483490        {
     491            STAM_REL_PROFILE_START(&pVCpu->em.s.StatHistoryProbe, b);
    484492            LogFlow(("EMHistoryExec/EXEC_PROBE: %RX64\n", pExitRec->uFlatPC));
    485493            PEMEXITREC   pExitRecUnconst = (PEMEXITREC)pExitRec;
     
    498506                pExitRecUnconst->enmAction = EMEXITACTION_EXEC_WITH_MAX;
    499507                LogFlow(("EMHistoryExec/EXEC_PROBE: -> EXEC_WITH_MAX %u\n", ExecStats.cMaxExitDistance));
     508                STAM_REL_COUNTER_INC(&pVCpu->em.s.StatHistoryProbedExecWithMax);
    500509            }
    501510#ifndef IN_RING3
    502511            else if (pVCpu->em.s.idxContinueExitRec != UINT16_MAX)
     512            {
     513                STAM_REL_COUNTER_INC(&pVCpu->em.s.StatHistoryProbedToRing3);
    503514                LogFlow(("EMHistoryExec/EXEC_PROBE: -> ring-3\n"));
     515            }
    504516#endif
    505517            else
     
    508520                pVCpu->em.s.idxContinueExitRec = UINT16_MAX;
    509521                LogFlow(("EMHistoryExec/EXEC_PROBE: -> PROBED\n"));
     522                STAM_REL_COUNTER_INC(&pVCpu->em.s.StatHistoryProbedNormal);
    510523            }
     524            STAM_REL_COUNTER_ADD(&pVCpu->em.s.StatHistoryProbeInstructions, ExecStats.cInstructions);
     525            STAM_REL_PROFILE_STOP(&pVCpu->em.s.StatHistoryProbe, b);
    511526            return rcStrict;
    512527        }
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r72580 r72582  
    484484            AssertRC(rc);
    485485        }
     486
     487        EM_REG_PROFILE(&pVCpu->em.s.StatHistoryExec,              "/EM/CPU%d/ExitOpt/Exec",              "Profiling normal EMHistoryExec operation.");
     488        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryExecSavedExits,    "/EM/CPU%d/ExitOpt/ExecSavedExit",     "Net number of saved exits.");
     489        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryExecInstructions,  "/EM/CPU%d/ExitOpt/ExecInstructions",  "Number of instructions executed during normal operation.");
     490        EM_REG_PROFILE(&pVCpu->em.s.StatHistoryProbe,             "/EM/CPU%d/ExitOpt/Probe",             "Profiling EMHistoryExec when probing.");
     491        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryProbeInstructions, "/EM/CPU%d/ExitOpt/ProbeInstructions", "Number of instructions executed during probing.");
     492        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryProbedNormal,      "/EM/CPU%d/ExitOpt/ProbedNormal",      "Number of EMEXITACTION_NORMAL_PROBED results.");
     493        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryProbedExecWithMax, "/EM/CPU%d/ExitOpt/ProbedExecWithMax", "Number of EMEXITACTION_EXEC_WITH_MAX results.");
     494        EM_REG_COUNTER(&pVCpu->em.s.StatHistoryProbedToRing3,     "/EM/CPU%d/ExitOpt/ProbedToRing3",     "Number of ring-3 probe continuations.");
    486495    }
    487496
  • trunk/src/VBox/VMM/include/EMInternal.h

    r72580 r72582  
    516516    /** Number of exit records in use. */
    517517    uint32_t                cExitRecordUsed;
     518    /** Profiling the EMHistoryExec when executing (not probing). */
     519    STAMPROFILE             StatHistoryExec;
     520    /** Number of saved exits. */
     521    STAMCOUNTER             StatHistoryExecSavedExits;
     522    /** Number of instructions executed by EMHistoryExec. */
     523    STAMCOUNTER             StatHistoryExecInstructions;
     524    uint64_t                aPadding3[2];
     525    /** Number of instructions executed by EMHistoryExec when probing. */
     526    STAMCOUNTER             StatHistoryProbeInstructions;
     527    /** Number of times probing resulted in EMEXITACTION_NORMAL_PROBED. */
     528    STAMCOUNTER             StatHistoryProbedNormal;
     529    /** Number of times probing resulted in EMEXITACTION_EXEC_WITH_MAX. */
     530    STAMCOUNTER             StatHistoryProbedExecWithMax;
     531    /** Number of times probing resulted in ring-3 continuation. */
     532    STAMCOUNTER             StatHistoryProbedToRing3;
     533    /** Profiling the EMHistoryExec when probing.*/
     534    STAMPROFILE             StatHistoryProbe;
    518535    /** Hit statistics for each lookup step. */
    519536    STAMCOUNTER             aStatHistoryRecHits[16];
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