Changeset 29436 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 12, 2010 8:57:57 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/IOM.cpp
r28800 r29436 466 466 if (RTAvloGCPhysInsert(&pVM->iom.s.pTreesR3->MMIOStatTree, &pStats->Core)) 467 467 { 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); 481 475 482 476 return pStats; -
trunk/src/VBox/VMM/IOMInternal.h
r28800 r29436 103 103 AVLOGCPHYSNODECORE Core; 104 104 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 107 109 /** 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; 112 111 /** Profiling write handler overhead in R3. */ 113 STAMPROFILE ADVProfWriteR3;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 119 118 /** Number of reads to this address from R0/RC which was serviced in R3. */ 120 119 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;126 120 /** Number of writes to this address from R0/RC which was serviced in R3. */ 127 121 STAMCOUNTER WriteRZToR3; 128 122 } IOMMMIOSTATS; 129 AssertCompileMemberAlignment(IOMMMIOSTATS, ReadR3, 8);123 AssertCompileMemberAlignment(IOMMMIOSTATS, Accesses, 8); 130 124 /** Pointer to I/O port statistics. */ 131 125 typedef IOMMMIOSTATS *PIOMMMIOSTATS; -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r28800 r29436 82 82 #endif 83 83 84 STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a); 84 85 int rc; 85 86 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!! */ 87 88 else 88 89 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); 91 92 return rc; 92 93 } … … 103 104 #endif 104 105 106 STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a); 105 107 int rc; 106 108 if (RT_LIKELY(pRange->CTX_SUFF(pfnReadCallback))) … … 137 139 } 138 140 } 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); 141 143 return rc; 142 144 } … … 1089 1091 : !pRange->CTX_SUFF(pfnReadCallback) && pRange->pfnReadCallbackR3) 1090 1092 { 1091 # ifdef VBOX_WITH_STATISTICS1092 1093 if (uErrorCode & X86_TRAP_PF_RW) 1093 1094 STAM_COUNTER_INC(&pStats->CTX_MID_Z(Write,ToR3)); 1094 1095 else 1095 1096 STAM_COUNTER_INC(&pStats->CTX_MID_Z(Read,ToR3)); 1096 # endif1097 1097 1098 1098 STAM_PROFILE_STOP(&pVM->iom.s.StatRZMMIOHandler, a); … … 1369 1369 # endif 1370 1370 } 1371 STAM_COUNTER_INC(&pStats->Accesses); 1371 1372 #endif /* VBOX_WITH_STATISTICS */ 1373 1372 1374 if (pRange->CTX_SUFF(pfnReadCallback)) 1373 1375 { … … 1375 1377 * Perform the read and deal with the result. 1376 1378 */ 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); 1380 1380 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); 1386 1382 switch (rc) 1387 1383 { 1388 1384 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 1389 1393 default: 1390 1394 Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, *pu32Value, cbValue, rc)); … … 1431 1435 * Lookup the ring-3 range. 1432 1436 */ 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); 1436 1439 /* Unassigned memory; this is actually not supposed to happen. */ 1437 1440 switch (cbValue) … … 1492 1495 # endif 1493 1496 } 1497 STAM_COUNTER_INC(&pStats->Accesses); 1494 1498 #endif /* VBOX_WITH_STATISTICS */ 1495 1499 … … 1500 1504 if (pRange->CTX_SUFF(pfnWriteCallback)) 1501 1505 { 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); 1505 1507 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)); 1510 1513 #endif 1511 1514 Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, rc)); … … 1525 1528 * No write handler, nothing to do. 1526 1529 */ 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); 1530 1532 Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, VINF_SUCCESS)); 1531 1533 iomUnlock(pVM); … … 1558 1560 VMMDECL(VBOXSTRICTRC) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer) 1559 1561 { 1560 #ifdef VBOX_WITH_STATISTICS1561 1562 STAM_COUNTER_INC(&pVM->iom.s.StatInstIns); 1562 #endif1563 1563 1564 1564 /* … … 1721 1721 VMMDECL(VBOXSTRICTRC) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer) 1722 1722 { 1723 #ifdef VBOX_WITH_STATISTICS1724 1723 STAM_COUNTER_INC(&pVM->iom.s.StatInstOuts); 1725 #endif1726 1724 1727 1725 /* -
trunk/src/VBox/VMM/testcase/tstVMStructRC.cpp
r28800 r29436 183 183 184 184 GEN_CHECK_SIZE(IOMMMIOSTATS); 185 GEN_CHECK_OFF(IOMMMIOSTATS, ReadR3); 185 GEN_CHECK_OFF(IOMMMIOSTATS, Accesses); 186 GEN_CHECK_OFF(IOMMMIOSTATS, WriteRZToR3); 186 187 187 188 GEN_CHECK_SIZE(IOMIOPORTRANGER0);
Note:
See TracChangeset
for help on using the changeset viewer.