VirtualBox

Changeset 10946 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 29, 2008 6:15:47 PM (16 years ago)
Author:
vboxsync
Message:

tstTimer: some adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstTimer.cpp

    r10941 r10946  
    152152        gu64Min = UINT64_MAX;
    153153        gu64Prev = 0;
    154         rc = RTTimerCreate(&pTimer, aTests[i].uMilliesInterval, TimerCallback, NULL);
     154        rc = RTTimerCreateEx(&pTimer, aTests[i].uMilliesInterval * (uint64_t)1000000, 0, TimerCallback, NULL);
    155155        if (RT_FAILURE(rc))
    156156        {
    157             RTPrintf("RTTimerCreate(,%d,) -> %d\n", aTests[i].uMilliesInterval, rc);
     157            RTPrintf("tstTimer: FAILURE - RTTimerCreateEx(,%u*1M,,,) -> %Rrc\n", aTests[i].uMilliesInterval, rc);
    158158            cErrors++;
    159159            continue;
     
    161161
    162162        /*
    163          * Active waiting for 2 seconds and then destroy it.
     163         * Start the timer and active waiting for the requested test period.
    164164         */
    165165        uint64_t uTSBegin = RTTimeNanoTS();
     166        rc = RTTimerStart(pTimer, 0);
     167        if (RT_FAILURE(rc))
     168        {
     169            RTPrintf("tstTimer: FAILURE - RTTimerStart(,0) -> %Rrc\n", aTests[i].uMilliesInterval, rc);
     170            cErrors++;
     171        }
     172
    166173        while (RTTimeNanoTS() - uTSBegin < (uint64_t)aTests[i].uMilliesWait * 1000000)
    167174            /* nothing */;
     175
     176        /* destroy the timer */
    168177        uint64_t uTSEnd = RTTimeNanoTS();
    169178        uint64_t uTSDiff = uTSEnd - uTSBegin;
    170         RTPrintf("uTS=%RI64 (%RU64 - %RU64)\n", uTSDiff, uTSBegin, uTSEnd);
    171         if (RT_FAILURE(rc))
    172             RTPrintf("warning: RTThreadSleep ended prematurely with %d\n", rc);
    173179        rc = RTTimerDestroy(pTimer);
    174180        if (RT_FAILURE(rc))
     
    176182            RTPrintf("tstTimer: FAILURE - RTTimerDestroy() -> %d gcTicks=%d\n", rc, gcTicks);
    177183            cErrors++;
    178             continue;
    179         }
     184        }
     185
     186        RTPrintf("tstTimer: uTS=%RI64 (%RU64 - %RU64)\n", uTSDiff, uTSBegin, uTSEnd);
    180187        unsigned cTicks = gcTicks;
    181         RTThreadSleep(100);
     188        RTThreadSleep(aTests[i].uMilliesInterval * 3);
    182189        if (gcTicks != cTicks)
    183190        {
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