- Timestamp:
- Apr 13, 2007 12:59:25 PM (18 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/TMAllCpu.cpp
r2069 r2075 40 40 * Gets the raw cpu tick from current virtual time. 41 41 */ 42 DECLINLINE(uint64_t) tmCpuTickGetRawVirtual(PVM pVM )42 DECLINLINE(uint64_t) tmCpuTickGetRawVirtual(PVM pVM, bool fCheckTimers = true) 43 43 { 44 uint64_t u64 = TMVirtualGet (pVM);44 uint64_t u64 = TMVirtualGetEx(pVM, fCheckTimers); 45 45 if (u64 != TMCLOCK_FREQ_VIRTUAL) 46 46 u64 = ASMMultU64ByU32DivByU32(u64, pVM->tm.s.cTSCTicksPerSecond, TMCLOCK_FREQ_VIRTUAL); … … 94 94 95 95 /** 96 * Returns the TSC offset 96 * Returns the TSC offset (virtual TSC - host TSC) 97 97 * 98 98 * @returns TSC ofset … … 101 101 TMDECL(uint64_t) TMCpuTickGetOffset(PVM pVM) 102 102 { 103 return pVM->tm.s.u64TSCOffset; 103 uint64_t u64; 104 if (RT_LIKELY(pVM->tm.s.fTSCTicking)) 105 { 106 if (pVM->tm.s.fTSCVirtualized) 107 { 108 if (pVM->tm.s.fTSCUseRealTSC) 109 u64 = ASMReadTSC(); 110 else 111 u64 = tmCpuTickGetRawVirtual(pVM, false /* don't check pending timers */); 112 u64 -= pVM->tm.s.u64TSCOffset; 113 } 114 else 115 u64 = ASMReadTSC(); 116 } 117 else 118 u64 = pVM->tm.s.u64TSC; 119 120 return u64 - ASMReadTSC(); 104 121 } 105 122 -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r1057 r2075 102 102 TMDECL(uint64_t) TMVirtualGet(PVM pVM) 103 103 { 104 return TMVirtualGetEx(pVM, true /* check timers */); 105 } 106 107 /** 108 * Gets the current TMCLOCK_VIRTUAL time 109 * 110 * @returns The timestamp. 111 * @param pVM VM handle. 112 * @param fCheckTimers Check timers or not 113 * 114 * @remark While the flow of time will never go backwards, the speed of the 115 * progress varies due to inaccurate RTTimeNanoTS and TSC. The latter can be 116 * influenced by power saving (SpeedStep, PowerNow!), while the former 117 * makes use of TSC and kernel timers. 118 */ 119 TMDECL(uint64_t) TMVirtualGetEx(PVM pVM, bool fCheckTimers) 120 { 104 121 uint64_t u64; 105 122 if (pVM->tm.s.fVirtualTicking) … … 111 128 * Use the chance to check for expired timers. 112 129 */ 113 if ( !VM_FF_ISSET(pVM, VM_FF_TIMER) 130 if ( fCheckTimers 131 && !VM_FF_ISSET(pVM, VM_FF_TIMER) 114 132 && ( pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL].u64Expire <= u64 115 133 || ( pVM->tm.s.fVirtualSyncTicking … … 130 148 return u64; 131 149 } 132 133 150 134 151 /**
Note:
See TracChangeset
for help on using the changeset viewer.