diff -r a179b74831c9 -r c1f20ce4abcf kerneltest/e32test/active/t_timerduration.cpp --- a/kerneltest/e32test/active/t_timerduration.cpp Thu Aug 19 11:14:22 2010 +0300 +++ b/kerneltest/e32test/active/t_timerduration.cpp Tue Aug 31 16:34:26 2010 +0300 @@ -52,6 +52,48 @@ TInt* TimeValue; TInt TimeMin[KMaxTimeValues]; TInt TimeMax[KMaxTimeValues]; + +RTimer TheTimer; + +void After(TInt aTime) + { + TRequestStatus s; + TheTimer.HighRes(s, aTime); + User::WaitForRequest(s); + } + +TInt Again(TInt aTime) + { + TRequestStatus s; + TheTimer.AgainHighRes(s, aTime); + User::WaitForRequest(s); + return s.Int(); + } + +void WaitInSteps(TUint aWait, TUint aPeriod, TUint aSteps) + { + TUint total_ticks = aWait / aPeriod; + TUint remain = total_ticks; + TUint steps = aSteps > remain ? remain : aSteps; + TUint carry = 0; + TUint step = 0; + while (remain) + { + TUint stepLength = remain / steps; + carry += stepLength; + TUint us = carry * aPeriod; + TInt r = KErrNone; + if (step==0) + After(us); + else + r = Again(us); + if (r==KErrNone) + carry = 0; + ++step; + --steps; + remain -= stepLength; + } + } void calcStats(TInt i) { @@ -66,20 +108,20 @@ void printStats() { - test.Printf(_L("Value\tMin\tMax")); + test.Printf(_L(" Value Min Max\n")); for (TInt i=0;i= TimeMax[k]); + } +#endif +/////////////////////////////////////////// + test.Next(_L("RTimer::AgainHighRes (5 steps)")); + MaxTimeMeasurements = KMaxTimeMeasurements; + TInt TimeValues6[KMaxTimeValues]={4000,8000,16000,32000,64000,128000,-1}; + TimeValue = &TimeValues6[0]; + __BEFORE_WAIT__ + __MEASURE1__ + WaitInSteps(value, tickPeriod, 5); + __MEASURE2__ + __AFTER_WAIT__ +#if defined(__EPOC32__) + //Check that RTimer::AgainHighRes() calls completed within boundaries + for (k = 0; k= TimeMax[k]); + } +#endif +/////////////////////////////////////////// + TheTimer.Close(); test.End(); return(KErrNone); }