VirtualBox

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


Ignore:
Timestamp:
May 12, 2010 8:57:57 PM (15 years ago)
Author:
vboxsync
Message:

IOM: Profile all callbacks, don't bother count the as we can derive that from the profiling. Adjusted the layout so that it easier to navigate in the GUI, adding a total count as a toplevel branch.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/IOM.cpp

    r28800 r29436  
    466466        if (RTAvloGCPhysInsert(&pVM->iom.s.pTreesR3->MMIOStatTree, &pStats->Core))
    467467        {
    468             /* register the statistics counters. */
    469             rc = STAMR3RegisterF(pVM, &pStats->ReadR3,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-R3", GCPhys); AssertRC(rc);
    470             rc = STAMR3RegisterF(pVM, &pStats->WriteR3,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-R3", GCPhys); AssertRC(rc);
    471             rc = STAMR3RegisterF(pVM, &pStats->ReadRZ,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZ", GCPhys); AssertRC(rc);
    472             rc = STAMR3RegisterF(pVM, &pStats->WriteRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZ", GCPhys); AssertRC(rc);
    473             rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZtoR3", GCPhys); AssertRC(rc);
    474             rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZtoR3", GCPhys); AssertRC(rc);
    475 
    476             /* Profiling */
    477             rc = STAMR3RegisterF(pVM, &pStats->ProfReadR3,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp-Read-R3/Prof", GCPhys); AssertRC(rc);
    478             rc = STAMR3RegisterF(pVM, &pStats->ProfWriteR3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp-Write-R3/Prof", GCPhys); AssertRC(rc);
    479             rc = STAMR3RegisterF(pVM, &pStats->ProfReadRZ,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp-Read-RZ/Prof", GCPhys); AssertRC(rc);
    480             rc = STAMR3RegisterF(pVM, &pStats->ProfWriteRZ, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp-Write-RZ/Prof", GCPhys); AssertRC(rc);
     468            rc = STAMR3RegisterF(pVM, &pStats->Accesses,    STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,     pszDesc, "/IOM/MMIO/%RGp",              GCPhys); AssertRC(rc);
     469            rc = STAMR3RegisterF(pVM, &pStats->ProfReadR3,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp/Read-R3",      GCPhys); AssertRC(rc);
     470            rc = STAMR3RegisterF(pVM, &pStats->ProfWriteR3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp/Write-R3",     GCPhys); AssertRC(rc);
     471            rc = STAMR3RegisterF(pVM, &pStats->ProfReadRZ,  STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp/Read-RZ",      GCPhys); AssertRC(rc);
     472            rc = STAMR3RegisterF(pVM, &pStats->ProfWriteRZ, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc, "/IOM/MMIO/%RGp/Write-RZ",     GCPhys); AssertRC(rc);
     473            rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,     pszDesc, "/IOM/MMIO/%RGp/Read-RZtoR3",  GCPhys); AssertRC(rc);
     474            rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,     pszDesc, "/IOM/MMIO/%RGp/Write-RZtoR3", GCPhys); AssertRC(rc);
    481475
    482476            return pStats;
  • trunk/src/VBox/VMM/IOMInternal.h

    r28800 r29436  
    103103    AVLOGCPHYSNODECORE          Core;
    104104
    105     /** Number of reads to this address from R3. */
    106     STAMCOUNTER                 ReadR3;
     105    /** Number of accesses (subtract ReadRZToR3 and WriteRZToR3 to get the right
     106     *  number). */
     107    STAMCOUNTER                 Accesses;
     108
    107109    /** Profiling read handler overhead in R3. */
    108     STAMPROFILEADV              ProfReadR3;
    109 
    110     /** Number of writes to this address from R3. */
    111     STAMCOUNTER                 WriteR3;
     110    STAMPROFILE                 ProfReadR3;
    112111    /** Profiling write handler overhead in R3. */
    113     STAMPROFILEADV              ProfWriteR3;
    114 
    115     /** Number of reads to this address from R0/RC. */
    116     STAMCOUNTER                 ReadRZ;
    117     /** Profiling read handler overhead in R0/RC. */
    118     STAMPROFILEADV              ProfReadRZ;
     112    STAMPROFILE                 ProfWriteR3;
     113    /** Counting and profiling reads in R0/RC. */
     114    STAMPROFILE                 ProfReadRZ;
     115    /** Counting and profiling writes in R0/RC. */
     116    STAMPROFILE                 ProfWriteRZ;
     117
    119118    /** Number of reads to this address from R0/RC which was serviced in R3. */
    120119    STAMCOUNTER                 ReadRZToR3;
    121 
    122     /** Number of writes to this address from R0/RC. */
    123     STAMCOUNTER                 WriteRZ;
    124     /** Profiling write handler overhead in R0/RC. */
    125     STAMPROFILEADV              ProfWriteRZ;
    126120    /** Number of writes to this address from R0/RC which was serviced in R3. */
    127121    STAMCOUNTER                 WriteRZToR3;
    128122} IOMMMIOSTATS;
    129 AssertCompileMemberAlignment(IOMMMIOSTATS, ReadR3, 8);
     123AssertCompileMemberAlignment(IOMMMIOSTATS, Accesses, 8);
    130124/** Pointer to I/O port statistics. */
    131125typedef IOMMMIOSTATS *PIOMMMIOSTATS;
  • trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp

    r28800 r29436  
    8282#endif
    8383
     84    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
    8485    int rc;
    8586    if (RT_LIKELY(pRange->CTX_SUFF(pfnWriteCallback)))
    86         rc = pRange->CTX_SUFF(pfnWriteCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhysFault, (void *)pvData, cb); /* @todo fix const!! */
     87        rc = pRange->CTX_SUFF(pfnWriteCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhysFault, (void *)pvData, cb); /** @todo fix const!! */
    8788    else
    8889        rc = VINF_SUCCESS;
    89     if (rc != VINF_IOM_HC_MMIO_WRITE)
    90         STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Write));
     90    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
     91    STAM_COUNTER_INC(&pStats->Accesses);
    9192    return rc;
    9293}
     
    103104#endif
    104105
     106    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a);
    105107    int rc;
    106108    if (RT_LIKELY(pRange->CTX_SUFF(pfnReadCallback)))
     
    137139        }
    138140    }
    139     if (rc != VINF_IOM_HC_MMIO_READ)
    140         STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Read));
     141    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
     142    STAM_COUNTER_INC(&pStats->Accesses);
    141143    return rc;
    142144}
     
    10891091        : !pRange->CTX_SUFF(pfnReadCallback)  && pRange->pfnReadCallbackR3)
    10901092    {
    1091 # ifdef VBOX_WITH_STATISTICS
    10921093        if (uErrorCode & X86_TRAP_PF_RW)
    10931094            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Write,ToR3));
    10941095        else
    10951096            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Read,ToR3));
    1096 # endif
    10971097
    10981098        STAM_PROFILE_STOP(&pVM->iom.s.StatRZMMIOHandler, a);
     
    13691369# endif
    13701370    }
     1371    STAM_COUNTER_INC(&pStats->Accesses);
    13711372#endif /* VBOX_WITH_STATISTICS */
     1373
    13721374    if (pRange->CTX_SUFF(pfnReadCallback))
    13731375    {
     
    13751377         * Perform the read and deal with the result.
    13761378         */
    1377 #ifdef VBOX_WITH_STATISTICS
    1378         STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfRead), a);
    1379 #endif
     1379        STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a);
    13801380        rc = pRange->CTX_SUFF(pfnReadCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhys, pu32Value, (unsigned)cbValue);
    1381 #ifdef VBOX_WITH_STATISTICS
    1382         STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
    1383         if (rc != VINF_IOM_HC_MMIO_READ)
    1384             STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Read));
    1385 #endif
     1381        STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
    13861382        switch (rc)
    13871383        {
    13881384            case VINF_SUCCESS:
     1385                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=VINF_SUCCESS\n", GCPhys, *pu32Value, cbValue));
     1386                iomUnlock(pVM);
     1387                return rc;
     1388#ifndef IN_RING3
     1389            case VINF_IOM_HC_MMIO_READ:
     1390            case VINF_IOM_HC_MMIO_READ_WRITE:
     1391                STAM_COUNTER_INC(&pStats->CTX_MID_Z(Read,ToR3));
     1392#endif
    13891393            default:
    13901394                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, *pu32Value, cbValue, rc));
     
    14311435     * Lookup the ring-3 range.
    14321436     */
    1433 #ifdef VBOX_WITH_STATISTICS
    1434     STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Read));
    1435 #endif
     1437    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a); /** @todo STAM_PROFILE_ADD_ZERO_PERIOD */
     1438    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
    14361439    /* Unassigned memory; this is actually not supposed to happen. */
    14371440    switch (cbValue)
     
    14921495# endif
    14931496    }
     1497    STAM_COUNTER_INC(&pStats->Accesses);
    14941498#endif /* VBOX_WITH_STATISTICS */
    14951499
     
    15001504    if (pRange->CTX_SUFF(pfnWriteCallback))
    15011505    {
    1502 #ifdef VBOX_WITH_STATISTICS
    1503         STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
    1504 #endif
     1506        STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
    15051507        rc = pRange->CTX_SUFF(pfnWriteCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhys, &u32Value, (unsigned)cbValue);
    1506 #ifdef VBOX_WITH_STATISTICS
    1507         STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
    1508         if (rc != VINF_IOM_HC_MMIO_WRITE)
    1509             STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Write));
     1508        STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
     1509#ifndef IN_RING3
     1510        if (    rc == VINF_IOM_HC_MMIO_WRITE
     1511            ||  rc == VINF_IOM_HC_MMIO_READ_WRITE)
     1512            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Write,ToR3));
    15101513#endif
    15111514        Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, rc));
     
    15251528     * No write handler, nothing to do.
    15261529     */
    1527 #ifdef VBOX_WITH_STATISTICS
    1528     STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Write));
    1529 #endif
     1530    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
     1531    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
    15301532    Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, VINF_SUCCESS));
    15311533    iomUnlock(pVM);
     
    15581560VMMDECL(VBOXSTRICTRC) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    15591561{
    1560 #ifdef VBOX_WITH_STATISTICS
    15611562    STAM_COUNTER_INC(&pVM->iom.s.StatInstIns);
    1562 #endif
    15631563
    15641564    /*
     
    17211721VMMDECL(VBOXSTRICTRC) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
    17221722{
    1723 #ifdef VBOX_WITH_STATISTICS
    17241723    STAM_COUNTER_INC(&pVM->iom.s.StatInstOuts);
    1725 #endif
    17261724
    17271725    /*
  • trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp

    r28800 r29436  
    183183
    184184    GEN_CHECK_SIZE(IOMMMIOSTATS);
    185     GEN_CHECK_OFF(IOMMMIOSTATS, ReadR3);
     185    GEN_CHECK_OFF(IOMMMIOSTATS, Accesses);
     186    GEN_CHECK_OFF(IOMMMIOSTATS, WriteRZToR3);
    186187
    187188    GEN_CHECK_SIZE(IOMIOPORTRANGER0);
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