Changeset 32749 in vbox for trunk/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
- Timestamp:
- Sep 24, 2010 9:28:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
r32742 r32749 124 124 if (iCpu < RTCPUSET_MAX_CPUS) 125 125 { 126 uint32_t iCountedTick = ASMAtomicIncU32(&paStates[iCpu].cTicks) - 1;127 RTR0TESTR0_CHECK_MSG(iCountedTick == iTick, 126 uint32_t iCountedTick = ASMAtomicIncU32(&paStates[iCpu].cTicks); 127 RTR0TESTR0_CHECK_MSG(iCountedTick == iTick, 128 128 ("iCountedTick=%u iTick=%u iCpu=%d idCpu=%u\n", iCountedTick, iTick, iCpu, idCpu)); 129 129 paStates[iCpu].u64Last = RTTimeSystemNanoTS(); 130 if ( paStates[iCpu].u64Start)130 if (!paStates[iCpu].u64Start) 131 131 { 132 132 paStates[iCpu].u64Start = paStates[iCpu].u64Last; 133 RTR0TESTR0_CHECK_MSG(iCountedTick == 0, ("iCountedTick=%u iCpu=%d idCpu=%u\n", iCountedTick, iCpu, idCpu));133 RTR0TESTR0_CHECK_MSG(iCountedTick == 1, ("iCountedTick=%u iCpu=%d idCpu=%u\n", iCountedTick, iCpu, idCpu)); 134 134 } 135 135 } … … 707 707 708 708 PRTTIMER pTimer; 709 uint32_t fFlags = TSTRTR0TIMER_IS_HIRES(uOperation) ? RTTIMER_FLAGS_HIGH_RES : 0; 709 uint32_t fFlags = (TSTRTR0TIMER_IS_HIRES(uOperation) ? RTTIMER_FLAGS_HIGH_RES : 0) 710 | RTTIMER_FLAGS_CPU_ALL; 710 711 RTR0TESTR0_CHECK_RC_BREAK(RTTimerCreateEx(&pTimer, cNsInterval, fFlags, tstRTR0TimerCallbackOmni, paStates), 711 712 VINF_SUCCESS); … … 723 724 RTMpGetOnlineSet(&OnlineSet); 724 725 725 for (uint32_t i = 0; i < 1000 && RTTimeSystemNanoTS() - uStartNsTS <= UINT32_C(1000000000); i++)726 RTThreadSleep( 10);726 for (uint32_t i = 0; i < 5000 && RTTimeSystemNanoTS() - uStartNsTS <= UINT32_C(1000000000); i++) 727 RTThreadSleep(2); 727 728 728 729 RTR0TESTR0_CHECK_RC_BREAK(RTTimerStop(pTimer), VINF_SUCCESS); 730 uint64_t cNsElapsedX = RTTimeNanoTS() - uStartNsTS; 729 731 730 732 /* Do a min/max on the start and stop times and calculate the test period. */ 731 uint64_t u64MinStart = UINT64_MAX;732 uint64_t u64MaxStop = 0;733 uint64_t u64MinStart = UINT64_MAX; 734 uint64_t u64MaxStop = 0; 733 735 for (uint32_t iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) 734 736 { … … 743 745 RTR0TESTR0_CHECK_MSG(u64MinStart < u64MaxStop, ("%llu, %llu", u64MinStart, u64MaxStop)); 744 746 uint64_t cNsElapsed = u64MaxStop - u64MinStart; 745 uint32_t cAvgTicks = cNsElapsed / cNsInterval; 747 RTR0TESTR0_CHECK_MSG(cNsElapsed <= cNsElapsedX + 1000, ("%llu, %llu", cNsElapsed, cNsElapsedX)); 748 uint32_t cAvgTicks = cNsElapsed / cNsInterval + 1; 746 749 747 750 /* Check tick counts. ASSUMES no cpu on- or offlining. … … 753 756 { 754 757 RTR0TESTR0_CHECK_MSG(RTCpuSetIsMemberByIndex(&OnlineSet, iCpu), ("%d\n", iCpu)); 755 RTR0TESTR0_CHECK_MSG(paStates[iCpu].cTicks >= cMinTicks,756 (" %u, min=%u, iCpu=%u\n", paStates[iCpu].cTicks, cMinTicks, iCpu));757 RTR0TESTR0_CHECK_MSG(paStates[iCpu].cTicks <= cMaxTicks,758 ("%u, max=%u, iCpu=%u\n", paStates[iCpu].cTicks, cMaxTicks, iCpu));758 RTR0TESTR0_CHECK_MSG(paStates[iCpu].cTicks <= cMaxTicks && paStates[iCpu].cTicks >= cMinTicks, 759 ("min=%u, ticks=%u, avg=%u max=%u, iCpu=%u, interval=%'u, elapsed=%'u/%'u\n", 760 cMinTicks, paStates[iCpu].cTicks, cAvgTicks, cMaxTicks, iCpu, 761 cNsInterval, cNsElapsed, cNsElapsedX)); 759 762 } 760 763 else
Note:
See TracChangeset
for help on using the changeset viewer.