- Timestamp:
- Oct 10, 2007 6:02:16 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25172
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/gvmm.h
r5211 r5233 100 100 /** Pointer to the GVMM statistics. */ 101 101 typedef GVMMSTATS *PGVMMSTATS; 102 /** Const pointer to the GVMM statistics. */ 103 typedef const GVMMSTATS *PCGVMMSTATS; 102 104 103 105 … … 120 122 GVMMR0DECL(int) GVMMR0SchedPoll(PVM pVM, bool fYield); 121 123 GVMMR0DECL(int) GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM); 124 GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM); 122 125 123 126 … … 155 158 GVMMSTATS Stats; 156 159 } GVMMQUERYSTATISTICSSREQ; 157 /** Pointer to a G MMR0AllocatePagesReq / VMMR0_DO_GMM_ALLOCATE_PAGES request buffer. */160 /** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */ 158 161 typedef GVMMQUERYSTATISTICSSREQ *PGVMMQUERYSTATISTICSSREQ; 159 162 160 163 GVMMR0DECL(int) GVMMR0QueryStatisticsReq(PVM pVM, PGVMMQUERYSTATISTICSSREQ pReq); 161 164 165 166 /** 167 * Request buffer for GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS. 168 * @see GVMMR0ResetStatistics. 169 */ 170 typedef struct GVMMRESETSTATISTICSSREQ 171 { 172 /** The header. */ 173 SUPVMMR0REQHDR Hdr; 174 /** The support driver session. */ 175 PSUPDRVSESSION pSession; 176 /** The statistics to reset. 177 * Any non-zero entry will be reset (if permitted). */ 178 GVMMSTATS Stats; 179 } GVMMRESETSTATISTICSSREQ; 180 /** Pointer to a GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS request buffer. */ 181 typedef GVMMRESETSTATISTICSSREQ *PGVMMRESETSTATISTICSSREQ; 182 183 GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PVM pVM, PGVMMRESETSTATISTICSSREQ pReq); 162 184 163 185 -
trunk/include/VBox/vmm.h
r5211 r5233 368 368 /** Call GVMMR0QueryStatistics(). */ 369 369 VMMR0_DO_GVMM_QUERY_STATISTICS, 370 /** Call GVMMR0ResetStatistics(). */ 371 VMMR0_DO_GVMM_RESET_STATISTICS, 370 372 371 373 /** Call VMMR0 Per VM Init. */ -
trunk/include/iprt/asm.h
r4473 r5233 1504 1504 /** 1505 1505 * Compiler memory barrier. 1506 * 1507 * Ensure that the compiler does not use any cached (register/tmp stack) memory 1506 * 1507 * Ensure that the compiler does not use any cached (register/tmp stack) memory 1508 1508 * values or any outstanding writes when returning from this function. 1509 * 1510 * This function must be used if non-volatile data is modified by a 1511 * device or the VMM. Typical cases are port access, MMIO access, 1509 * 1510 * This function must be used if non-volatile data is modified by a 1511 * device or the VMM. Typical cases are port access, MMIO access, 1512 1512 * trapping instruction, etc. 1513 1513 */ … … 1519 1519 DECLINLINE(void) ASMCompilerBarrier(void) 1520 1520 { 1521 __asm 1522 { 1523 } 1524 } 1525 #endif 1521 __asm 1522 { 1523 } 1524 } 1525 #endif 1526 1526 1527 1527 … … 1782 1782 #else 1783 1783 return (bool)ASMAtomicXchgU8((volatile uint8_t *)pf, (uint8_t)f); 1784 #endif 1784 #endif 1785 1785 } 1786 1786 … … 2770 2770 2771 2771 2772 /** 2773 * Checks if a memory block is filled with the specified byte. 2774 * 2775 * This is a sort of inverted memchr. 2776 * 2777 * @returns Pointer to the byte which doesn't equal u8. 2778 * @returns NULL if all equal to u8. 2779 * 2780 * @param pv Pointer to the memory block. 2781 * @param cb Number of bytes in the block. This MUST be aligned on 32-bit! 2782 * @param u8 The value it's supposed to be filled with. 2783 */ 2784 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2785 DECLASM(void *) ASMMemIsAll8(void const *pv, size_t cb, uint8_t u8); 2786 #else 2787 DECLINLINE(void *) ASMMemIsAll8(void const *pv, size_t cb, uint8_t u8) 2788 { 2789 /** @todo rewrite this in inline assembly. */ 2790 uint8_t const *pb = (uint8_t const *)pv; 2791 for (; cb; cb--, pb++) 2792 if (RT_UNLIKELY(*pb != u8)) 2793 return (void *)pb; 2794 return NULL; 2795 } 2796 #endif 2797 2798 2772 2799 2773 2800 /** … … 2912 2939 * @note Don't use 64-bit C arithmetic here since some gcc compilers generate references to 2913 2940 * __udivdi3 and __umoddi3 even if this inline function is not used. 2914 * 2941 * 2915 2942 * @returns (u64A * u32B) / u32C. 2916 2943 * @param u64A The 64-bit value. … … 2928 2955 __asm__ __volatile__("mulq %2\n\t" 2929 2956 "divq %3\n\t" 2930 : "=a" (u64Result), 2957 : "=a" (u64Result), 2931 2958 "=d" (u64Spill) 2932 2959 : "r" ((uint64_t)u32B), 2933 2960 "r" ((uint64_t)u32C), 2934 "0" (u64A), 2961 "0" (u64A), 2935 2962 "1" (0)); 2936 2963 return u64Result; … … 2972 2999 u.s.Lo = (uint32_t)((((u64Hi % u32C) << 32) + (u64Lo & 0xffffffff)) / u32C); 2973 3000 return u.u; 2974 # endif 2975 } 2976 #endif 3001 # endif 3002 } 3003 #endif 2977 3004 2978 3005 -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r5232 r5233 1467 1467 } 1468 1468 1469 1470 /** 1471 * Resets the specified GVMM statistics. 1472 * 1473 * @returns VBox status code. 1474 * 1475 * @param pStats Which statistics to reset, that is, non-zero fields indicates which to reset. 1476 * @param pSession The current session. 1477 * @param pVM The VM to reset statistics for. Optional. 1478 */ 1479 GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM) 1480 { 1481 LogFlow(("GVMMR0ResetStatistics: pStats=%p pSession=%p pVM=%p\n", pStats, pSession, pVM)); 1482 1483 /* 1484 * Validate input. 1485 */ 1486 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 1487 AssertPtrReturn(pStats, VERR_INVALID_POINTER); 1488 1489 /* 1490 * Take the lock and get the VM statistics. 1491 */ 1492 PGVMM pGVMM; 1493 if (pVM) 1494 { 1495 PGVM pGVM; 1496 int rc = gvmmR0ByVM(pVM, &pGVM, &pGVMM, true /*fTakeUsedLock*/); 1497 if (RT_FAILURE(rc)) 1498 return rc; 1499 # define MAYBE_RESET_FIELD(field) \ 1500 do { if (pStats->SchedVM. field ) { pGVM->gvmm.s.StatsSched. field = 0; } } while (0) 1501 MAYBE_RESET_FIELD(cHaltCalls); 1502 MAYBE_RESET_FIELD(cHaltBlocking); 1503 MAYBE_RESET_FIELD(cHaltTimeouts); 1504 MAYBE_RESET_FIELD(cHaltNotBlocking); 1505 MAYBE_RESET_FIELD(cHaltWakeUps); 1506 MAYBE_RESET_FIELD(cWakeUpCalls); 1507 MAYBE_RESET_FIELD(cWakeUpNotHalted); 1508 MAYBE_RESET_FIELD(cWakeUpWakeUps); 1509 MAYBE_RESET_FIELD(cPollCalls); 1510 MAYBE_RESET_FIELD(cPollHalts); 1511 MAYBE_RESET_FIELD(cPollWakeUps); 1512 # undef MAYBE_RESET_FIELD 1513 } 1514 else 1515 { 1516 GVMM_GET_VALID_INSTANCE(pGVMM, VERR_INTERNAL_ERROR); 1517 1518 int rc = RTSemFastMutexRequest(pGVMM->UsedLock); 1519 AssertRCReturn(rc, rc); 1520 } 1521 1522 /* 1523 * Enumerate the VMs and add the ones visibile to the statistics. 1524 */ 1525 if (ASMMemIsAll8(&pStats->SchedSum, sizeof(pStats->SchedSum), 0)) 1526 { 1527 for (unsigned i = pGVMM->iUsedHead; 1528 i != NIL_GVM_HANDLE && i < RT_ELEMENTS(pGVMM->aHandles); 1529 i = pGVMM->aHandles[i].iNext) 1530 { 1531 PGVM pGVM = pGVMM->aHandles[i].pGVM; 1532 void *pvObj = pGVMM->aHandles[i].pvObj; 1533 if ( VALID_PTR(pvObj) 1534 && VALID_PTR(pGVM) 1535 && pGVM->u32Magic == GVM_MAGIC 1536 && RT_SUCCESS(SUPR0ObjVerifyAccess(pvObj, pSession, NULL))) 1537 { 1538 # define MAYBE_RESET_FIELD(field) \ 1539 do { if (pStats->SchedSum. field ) { pGVM->gvmm.s.StatsSched. field = 0; } } while (0) 1540 MAYBE_RESET_FIELD(cHaltCalls); 1541 MAYBE_RESET_FIELD(cHaltBlocking); 1542 MAYBE_RESET_FIELD(cHaltTimeouts); 1543 MAYBE_RESET_FIELD(cHaltNotBlocking); 1544 MAYBE_RESET_FIELD(cHaltWakeUps); 1545 MAYBE_RESET_FIELD(cWakeUpCalls); 1546 MAYBE_RESET_FIELD(cWakeUpNotHalted); 1547 MAYBE_RESET_FIELD(cWakeUpWakeUps); 1548 MAYBE_RESET_FIELD(cPollCalls); 1549 MAYBE_RESET_FIELD(cPollHalts); 1550 MAYBE_RESET_FIELD(cPollWakeUps); 1551 # undef MAYBE_RESET_FIELD 1552 } 1553 } 1554 } 1555 1556 RTSemFastMutexRelease(pGVMM->UsedLock); 1557 1558 return VINF_SUCCESS; 1559 } 1560 1561 1562 /** 1563 * VMMR0 request wrapper for GVMMR0ResetStatistics. 1564 * 1565 * @returns see GVMMR0ResetStatistics. 1566 * @param pVM Pointer to the shared VM structure. Optional. 1567 * @param pReq The request packet. 1568 */ 1569 GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PVM pVM, PGVMMRESETSTATISTICSSREQ pReq) 1570 { 1571 /* 1572 * Validate input and pass it on. 1573 */ 1574 AssertPtrReturn(pReq, VERR_INVALID_POINTER); 1575 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER); 1576 1577 return GVMMR0ResetStatistics(&pReq->Stats, pReq->pSession, pVM); 1578 } 1579 -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r5211 r5233 714 714 return GVMMR0QueryStatisticsReq(pVM, (PGVMMQUERYSTATISTICSSREQ)pReqHdr); 715 715 716 case VMMR0_DO_GVMM_RESET_STATISTICS: 717 if (u64Arg) 718 return VERR_INVALID_PARAMETER; 719 return GVMMR0QueryStatisticsReq(pVM, (PGVMMQUERYSTATISTICSSREQ)pReqHdr); 720 716 721 /* 717 722 * Initialize the R0 part of a VM instance.
Note:
See TracChangeset
for help on using the changeset viewer.