VirtualBox

Changeset 2468 in vbox for trunk


Ignore:
Timestamp:
May 3, 2007 4:43:10 PM (18 years ago)
Author:
vboxsync
Message:

Dropping the VBOX_WITH_VIRTUAL_SYNC_TIMERS #ifdefs, making it default.

Location:
trunk/src/VBox/Devices
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile

    r2456 r2468  
    5454 DEFS += VBOX_WITH_INTERNAL_NETWORKING
    5555endif
    56 #ifeq ($(USERNAME),bird)
    57  DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS
    58 #endif
    5956
    6057# enable the pdm lock.
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r2285 r2468  
    15951595    }
    15961596
    1597 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    15981597    rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL_SYNC, acpiTimer, "ACPI Timer", &s->tsHC);
    1599 #else
    1600     rc = PDMDevHlpTMTimerCreate (pDevIns, TMCLOCK_VIRTUAL, acpiTimer, "ACPI Timer", &s->tsHC);
    1601 #endif
    16021598    if (VBOX_FAILURE(rc))
    16031599    {
  • trunk/src/VBox/Devices/PC/DevAPIC.cpp

    r2285 r2468  
    17251725     * Create the APIC timer.
    17261726     */
    1727 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    17281727    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, apicTimer,
    1729 #else
    1730     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, apicTimer,
    1731 #endif
    17321728                                "APIC Timer", &pData->CTXSUFF(pTimer));
    17331729    if (VBOX_FAILURE(rc))
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r2285 r2468  
    9393     * As apposed to the next_transition_time which contains the correct time of the next tick. */
    9494    uint64_t            u64NextTS;
    95 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    96     /** When to give up catching up. (negative number) */
    97     int64_t             i64MaxCatchupTS;
    98 #endif
    9995
    10096    /** (count_load_time is only set by TMTimerGet() which returns uint64_t) */
     
    138134    /** Profiling the timer callback handler. */
    139135    STAMPROFILEADV          StatPITHandler;
    140 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    141     /** 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 #endif
    146136} PITState;
    147137
     
    404394    }
    405395
    406 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    407396    if (expire_time != -1)
    408397    {
     
    410399        TMTimerSet(s->CTXSUFF(pTimer), s->u64NextTS);
    411400    }
    412 #else
    413     /* 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 guest
    423                  * with timer interrupts because the next interrupt(s) would probably raise
    424                  * 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             else
    433             {
    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         else
    443         {
    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 #endif
    453401    else
    454402    {
     
    993941     * Create timer, register I/O Ports and save state.
    994942     */
    995 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    996943    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, pitTimer, "i8254 Programmable Interval Timer",
    997 #else
    998     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pitTimer, "i8254 Programmable Interval Timer",
    999 #endif
    1000944                                &pData->channels[0].CTXSUFF(pTimer));
    1001945    if (VBOX_FAILURE(rc))
     
    1040984        return rc;
    1041985
    1042 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    1043     /*
    1044      * Calculate max catchup time.
    1045      */
    1046     pData->channels[0].i64MaxCatchupTS = pData->channels[1].i64MaxCatchupTS
    1047         = pData->channels[2].i64MaxCatchupTS = -TMTimerFromMilli(pData->channels[0].CTXSUFF(pTimer), 1000*60*2); /* 2 min */
    1048 #endif
    1049 
    1050986    /*
    1051987     * Initialize the device state.
     
    1058994    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITIrq,      STAMTYPE_COUNTER, "/TM/PIT/Irq",      STAMUNIT_OCCURENCES,     "The number of times a timer interrupt was triggered.");
    1059995    PDMDevHlpSTAMRegister(pDevIns, &pData->StatPITHandler,  STAMTYPE_PROFILE, "/TM/PIT/Handler",  STAMUNIT_TICKS_PER_CALL, "Profiling timer callback handler.");
    1060 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    1061     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 #endif
    1064996
    1065997    PDMDevHlpDBGFInfoRegister(pDevIns, "pit", "Display PIT (i8254) status. (no arguments)", pitInfo);
  • trunk/src/VBox/Devices/PC/DevRTC.cpp

    r2285 r2468  
    165165        next_irq_clock = (cur_clock & ~(uint64_t)(period - 1)) + period;
    166166        s->next_periodic_time = ASMMultU64ByU32DivByU32(next_irq_clock, freq, 32768) + 1;
    167 #ifdef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    168167        TMTimerSet(s->CTXSUFF(pPeriodicTimer), s->next_periodic_time);
    169168       
    170 #else
    171         /* 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         else
    181         {
    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 #endif
    188169    } else {
    189170        TMTimerStop(s->CTXSUFF(pPeriodicTimer));
  • trunk/src/VBox/Devices/testcase/Makefile

    r2456 r2468  
    2626#
    2727PROGRAMS = tstDeviceStructSize tstDeviceStructSizeGC
    28 
    29 ## temp hack.
    30 #ifeq ($(USERNAME),bird)
    31  DEFS += VBOX_WITH_VIRTUAL_SYNC_TIMERS
    32 #endif
    3328
    3429
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp

    r2285 r2468  
    447447    GEN_CHECK_OFF(PITChannelState, u64ReloadTS);
    448448    GEN_CHECK_OFF(PITChannelState, u64NextTS);
    449 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    450     GEN_CHECK_OFF(PITChannelState, i64MaxCatchupTS);
    451 #endif
    452449    GEN_CHECK_OFF(PITChannelState, count_load_time);
    453450    GEN_CHECK_OFF(PITChannelState, next_transition_time);
     
    474471    GEN_CHECK_OFF(PITState, StatPITIrq);
    475472    GEN_CHECK_OFF(PITState, StatPITHandler);
    476 #ifndef VBOX_WITH_VIRTUAL_SYNC_TIMERS
    477     GEN_CHECK_OFF(PITState, StatPITCatchup);
    478     GEN_CHECK_OFF(PITState, StatPITGiveup);
    479 #endif
    480473
    481474    /* PC/DevRTC.cpp */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette