Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003

    How Accurate is TTIme?


    Im having a timing problem on 3650 and Emulator.

    Here's my algo. Im using Microseconds as unit for my timers

    * Init iMicroSecCycle to 1000000(microsec)/10
    *Create CActive set timer to iMicroSecCycle
    * Init Timer iTimer.After(iStatus,iMicroSecCycle);
    * SetActive
    *On RunL it does some long routines
    *Init TTime startTime.HomeTime()
    * Do some process here / Draw / Read from file
    * Cancel CActive is EOF reached (should be 30 seconds)
    *Init TTIme endTime.HomeTime()
    *compute TInt nDelta = timeEnd.MicroSecondsFrom(timeStart).Int64().GetTInt();
    * nDelta is always less than iMicroSecCycle
    * TTimeIntervalMicroSeconds32 tDelta(iMicroSecCycle-nDelta);
    * Init Timer iTimer.After(iStatus,tDelta);
    * SetActive - will invoke RunL after tDelta lapse

    It should only last for 30 seconds but on emulator its 45 seconds and on actual handset its 36 seconds

    Is TTime::HomeTime Accurate?
    Is RTimer::After Accurate?
    Is microseconds unit the base for timer?
    Am i doing something wrong?

  2. #2
    Registered User
    Join Date
    Apr 2003
    Stockholm, Sweden
    this is what i have in my event loop:

    // timer request has completed, lets post a nilEvent!
    if (iStatus == KErrNone)
        TTime timeA, timeB;
        TInt32 timerDiff;

        // do work

        // put a request for the next event
        timerDiff = gGlobals->evtTimeOut - timeB.MicroSecondsFrom(timeA).Int64().Low();
    &nbsp;&nbsp;&nbsp;&nbsp;if (timerDiff < 1) timerDiff = 1; // must be positive
    &nbsp;&nbsp;&nbsp;&nbsp;After(TTimeIntervalMicroSeconds32( timerDiff));

    i found that TTime.HomeTime() only reports to multiples of 10000 microseconds (10 milliseconds), which, is kinda normal for most mobile devices. this is not the best accuracy, however, it is pretty close to what it needed. ideally, the most optimal method would be to do the CTimer::After call at the start of the routine, but, then you will run into problems with the thread trying to restart while the old is still going. this normally leads to ViewSvr 11 errors

    i have our cube3d demo currently working within the 'app' frame work running at around 40-45 fps. the display doesn't seem capable on the unit of rendering 30 fps, but, the speeds are totally possible - i dont think it is your timer events slowing you down our demo originally ran at 4-5 fps, and, there are a lot of ways to optimize/speed your applications up. Nokia is hopeless at documenting stuff, so, i found out by stress testing and trying everything under the book until i found performance gains.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts