vbox的更動 2283 路徑 trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
- 時間撮記:
- 2007-4-20 下午10:27:52 (18 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r2248 r2283 96 96 { 97 97 uint64_t u64; 98 if ( pVM->tm.s.fVirtualTicking)98 if (RT_LIKELY(pVM->tm.s.fVirtualTicking)) 99 99 { 100 100 STAM_COUNTER_INC(&pVM->tm.s.StatVirtualGet); … … 108 108 && ( pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL].u64Expire <= u64 109 109 || ( pVM->tm.s.fVirtualSyncTicking 110 && pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL_SYNC].u64Expire <= u64 - pVM->tm.s. u64VirtualSyncOffset110 && pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL_SYNC].u64Expire <= u64 - pVM->tm.s.offVirtualSync 111 111 ) 112 112 ) … … 114 114 { 115 115 VM_FF_SET(pVM, VM_FF_TIMER); 116 STAM_COUNTER_INC(&pVM->tm.s.StatVirtualGetSetFF); 116 117 #ifdef IN_RING3 117 118 REMR3NotifyTimerPending(pVM); … … 190 191 VMR3NotifyFF(pVM, true); 191 192 #endif 193 STAM_COUNTER_INC(&pVM->tm.s.StatVirtualGetSyncSetFF); 192 194 } 193 195 … … 210 212 * 211 213 * Assuming nano second virtual time, we can simply ignore any intervals which has 212 * any of the upper 32 bits set. This will have the nice sideeffect of allowing us 213 * to use (faster) 32-bit math. 214 * any of the upper 32 bits set. 214 215 */ 215 AssertCompile(TMCLOCK_FREQ_VIRTUAL <= 2000000000); /* (assumes low 32-bit >= 2 seconds) */216 uint64_t u64Offset = pVM->tm.s.u64VirtualSyncOffset;216 AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000); 217 uint64_t off = pVM->tm.s.offVirtualSync; 217 218 if (pVM->tm.s.fVirtualSyncCatchUp) 218 219 { … … 221 222 if (RT_LIKELY(!(u64Delta >> 32))) 222 223 { 223 uint32_t u32Sub = ASMDivU64ByU32RetU32(ASMMult2xU32RetU64((uint32_t)u64Delta, pVM->tm.s.u32VirtualSyncCatchUpPercentage), 224 100); 225 if (u64Offset > u32Sub) 224 uint64_t u64Sub = ASMMultU64ByU32DivByU32(u64Delta, pVM->tm.s.u32VirtualSyncCatchUpPercentage, 100); 225 if (off > u64Sub + pVM->tm.s.offVirtualSyncGivenUp) 226 226 { 227 u64Offset -= u32Sub;228 ASMAtomicXchgU64(&pVM->tm.s. u64VirtualSyncOffset, u64Offset);227 off -= u64Sub; 228 ASMAtomicXchgU64(&pVM->tm.s.offVirtualSync, off); 229 229 pVM->tm.s.u64VirtualSyncCatchUpPrev = u64; 230 Log4(("TM: %RU64/%RU64: sub %RU32\n", u64 - off, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp, u64Sub)); 230 231 } 231 232 else 232 233 { 233 234 /* we've completely caught up. */ 234 u64Offset = 0; 235 ASMAtomicXchgU64(&pVM->tm.s.u64VirtualSyncOffset, 0); 235 STAM_PROFILE_ADV_STOP(&pVM->tm.s.StatVirtualSyncCatchup, c); 236 off = pVM->tm.s.offVirtualSyncGivenUp; 237 ASMAtomicXchgU64(&pVM->tm.s.offVirtualSync, off); 236 238 ASMAtomicXchgBool(&pVM->tm.s.fVirtualSyncCatchUp, false); 237 239 pVM->tm.s.u64VirtualSyncCatchUpPrev = u64; 240 Log4(("TM: %RU64/0: caught up\n", u64)); 238 241 } 239 242 } … … 252 255 * set the the timer pending flag. 253 256 */ 254 u64 -= u64Offset;257 u64 -= off; 255 258 const uint64_t u64Expire = pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL_SYNC].u64Expire; 256 259 if (u64 >= u64Expire) … … 266 269 VMR3NotifyFF(pVM, true); 267 270 #endif 271 STAM_COUNTER_INC(&pVM->tm.s.StatVirtualGetSyncSetFF); 272 Log4(("TM: %RU64/%RU64: exp tmr=>ff\n", u64, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp)); 268 273 } 274 else 275 Log4(("TM: %RU64/%RU64: exp tmr\n", u64, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp)); 269 276 } 270 277 } … … 283 290 TMDECL(uint64_t) TMVirtualSyncGetLag(PVM pVM) 284 291 { 285 return pVM->tm.s. u64VirtualSyncOffset;292 return pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp; 286 293 } 287 294
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器