- Timestamp:
- May 3, 2007 4:43:10 PM (18 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Makefile
r2456 r2468 54 54 DEFS += VBOX_WITH_INTERNAL_NETWORKING 55 55 endif 56 #ifeq ($(USERNAME),bird)57 DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS58 #endif59 56 60 57 # enable the pdm lock. -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r2285 r2468 1595 1595 } 1596 1596 1597 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS1598 1597 rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL_SYNC, acpiTimer, "ACPI Timer", &s->tsHC); 1599 #else1600 rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL, acpiTimer, "ACPI Timer", &s->tsHC);1601 #endif1602 1598 if (VBOX_FAILURE(rc)) 1603 1599 { -
trunk/src/VBox/Devices/PC/DevAPIC.cpp
r2285 r2468 1725 1725 * Create the APIC timer. 1726 1726 */ 1727 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS1728 1727 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, apicTimer, 1729 #else1730 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, apicTimer,1731 #endif1732 1728 "APIC Timer", &pData->CTXSUFF(pTimer)); 1733 1729 if (VBOX_FAILURE(rc)) -
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r2285 r2468 93 93 * As apposed to the next_transition_time which contains the correct time of the next tick. */ 94 94 uint64_t u64NextTS; 95 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS96 /** When to give up catching up. (negative number) */97 int64_t i64MaxCatchupTS;98 #endif99 95 100 96 /** (count_load_time is only set by TMTimerGet() which returns uint64_t) */ … … 138 134 /** Profiling the timer callback handler. */ 139 135 STAMPROFILEADV StatPITHandler; 140 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS141 /** The number of times we've had to speed up the time because we lagged too far behind. */142 STAMCOUNTER StatPITCatchup;143 /** The number of times we've lagged too far behind for it to be worth trying to catch up. */144 STAMCOUNTER StatPITGiveup;145 #endif146 136 } PITState; 147 137 … … 404 394 } 405 395 406 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS407 396 if (expire_time != -1) 408 397 { … … 410 399 TMTimerSet(s->CTXSUFF(pTimer), s->u64NextTS); 411 400 } 412 #else413 /* check if it expires too soon - move at 4x rate if it does. */414 if (expire_time != -1)415 {416 int64_t delta = expire_time - now;417 const int64_t quarter = (expire_time - s->next_transition_time) >> 2;418 if (delta <= quarter && s->next_transition_time != -1)419 {420 if (delta >= s->i64MaxCatchupTS)421 {422 /* If we set the timer to 'expire_time' we could end up with flooding the guest423 * with timer interrupts because the next interrupt(s) would probably raise424 * immediately. Therefore we set the timer to 'now + quarter' with quarter>0.425 * This delays the adaption a little bit. */426 STAM_COUNTER_INC(&s->CTXSUFF(pPit)->StatPITCatchup);427 s->u64NextTS = now + quarter;428 LogFlow(("PIT: m=%d cnt=%#4x irq=%#x delay=%8RI64 next=%20RI64 now=%20RI64 load=%20RI64 %9RI64 delta=%9RI64\n",429 s->mode, s->count, irq_level, quarter, s->u64NextTS, now, s->count_load_time,430 ASMMultU64ByU32DivByU32(s->u64NextTS - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer)), delta));431 }432 else433 {434 /* We are too far away from the real time. Hard synchronize. */435 STAM_COUNTER_INC(&s->CTXSUFF(pPit)->StatPITGiveup);436 s->u64NextTS = expire_time = pit_get_next_transition_time(s, now);437 LogFlow(("PIT: m=%d cnt=%#4x irq=%#x delay=%8RI64 next=%20RI64 now=%20RI64 load=%20RI64 %9RI64 delta=%9RI64 giving up!\n",438 s->mode, s->count, irq_level, quarter, s->u64NextTS, now, s->count_load_time,439 ASMMultU64ByU32DivByU32(s->u64NextTS - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer)), delta));440 }441 }442 else443 {444 /* Everything is fine, just set the timer to the regular next expire_time. */445 s->u64NextTS = expire_time;446 LogFlow(("PIT: m=%d cnt=%#4x irq=%#x delay=%8RI64 next=%20RI64 now=%20RI64 load=%20RI64 %9RI64\n",447 s->mode, s->count, irq_level, expire_time - now, expire_time, now, s->count_load_time,448 ASMMultU64ByU32DivByU32(expire_time - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer))));449 }450 TMTimerSet(s->CTXSUFF(pTimer), s->u64NextTS);451 }452 #endif453 401 else 454 402 { … … 993 941 * Create timer, register I/O Ports and save state. 994 942 */ 995 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS996 943 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, "i8254 Programmable Interval Timer", 997 #else998 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pitTimer, "i8254 Programmable Interval Timer",999 #endif1000 944 &pData->channels[0].CTXSUFF(pTimer)); 1001 945 if (VBOX_FAILURE(rc)) … … 1040 984 return rc; 1041 985 1042 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS1043 /*1044 * Calculate max catchup time.1045 */1046 pData->channels[0].i64MaxCatchupTS = pData->channels[1].i64MaxCatchupTS1047 = pData->channels[2].i64MaxCatchupTS = -TMTimerFromMilli(pData->channels[0].CTXSUFF(pTimer), 1000*60*2); /* 2 min */1048 #endif1049 1050 986 /* 1051 987 * Initialize the device state. … … 1058 994 PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITIrq, STAMTYPE_COUNTER, "/TM/PIT/Irq", STAMUNIT_OCCURENCES, "The number of times a timer interrupt was triggered."); 1059 995 PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITHandler, STAMTYPE_PROFILE, "/TM/PIT/Handler", STAMUNIT_TICKS_PER_CALL, "Profiling timer callback handler."); 1060 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS1061 PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITCatchup, STAMTYPE_COUNTER, "/TM/PIT/Catchup", STAMUNIT_OCCURENCES, "The number of times we lagged too far behind.");1062 PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITGiveup, STAMTYPE_COUNTER, "/TM/PIT/Giveup", STAMUNIT_OCCURENCES, "The number of times we lagged so far behind that we simply gave up.");1063 #endif1064 996 1065 997 PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitInfo); -
trunk/src/VBox/Devices/PC/DevRTC.cpp
r2285 r2468 165 165 next_irq_clock = (cur_clock & ~(uint64_t)(period - 1)) + period; 166 166 s->next_periodic_time = ASMMultU64ByU32DivByU32(next_irq_clock, freq, 32768) + 1; 167 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS168 167 TMTimerSet(s->CTXSUFF(pPeriodicTimer), s->next_periodic_time); 169 168 170 #else171 /* fiddly bits for dealing with running to keep up and losing interrupts. */172 uint64_t quarter_period_time = ASMMultU64ByU32DivByU32(period, freq, 32768 * 4);173 uint64_t now = TMTimerGet(s->CTXSUFF(pPeriodicTimer));174 int64_t delta = s->next_periodic_time - now;175 if (delta >= (int64_t)quarter_period_time)176 {177 TMTimerSet(s->CTXSUFF(pPeriodicTimer), s->next_periodic_time);178 Log2(("period=%d current_time=%RU64 next=%RU64 delta=%-10RI64\n", period, current_time, s->next_periodic_time, delta));179 }180 else181 {182 uint64_t next = now + quarter_period_time; /* 4x speed */183 TMTimerSet(s->CTXSUFF(pPeriodicTimer), next);184 Log2(("period=%d current_time=%RU64 next=%RU64 delta=%-10RI64 now=%RU64 real_next=%RU64\n", period, current_time,185 s->next_periodic_time, delta, now, next));186 }187 #endif188 169 } else { 189 170 TMTimerStop(s->CTXSUFF(pPeriodicTimer)); -
trunk/src/VBox/Devices/testcase/Makefile
r2456 r2468 26 26 # 27 27 PROGRAMS = tstDeviceStructSize tstDeviceStructSizeGC 28 29 ## temp hack.30 #ifeq ($(USERNAME),bird)31 DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS32 #endif33 28 34 29 -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp
r2285 r2468 447 447 GEN_CHECK_OFF(PITChannelState, u64ReloadTS); 448 448 GEN_CHECK_OFF(PITChannelState, u64NextTS); 449 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS450 GEN_CHECK_OFF(PITChannelState, i64MaxCatchupTS);451 #endif452 449 GEN_CHECK_OFF(PITChannelState, count_load_time); 453 450 GEN_CHECK_OFF(PITChannelState, next_transition_time); … … 474 471 GEN_CHECK_OFF(PITState, StatPITIrq); 475 472 GEN_CHECK_OFF(PITState, StatPITHandler); 476 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS477 GEN_CHECK_OFF(PITState, StatPITCatchup);478 GEN_CHECK_OFF(PITState, StatPITGiveup);479 #endif480 473 481 474 /* PC/DevRTC.cpp */
Note:
See TracChangeset
for help on using the changeset viewer.