Community: Wiki

你在这里: You Are Here: Olet tässä: Vous êtes ici: Sie befinden sich hier: Tu sei qui: 現在のページ: Você está aqui: Вы здесь: Usted está aquí:
This page was last modified 08:22, 9 April 2008.

Using timers

From Forum Nokia Wiki

Developers have several options to profile application behavior with timers. Each of these options have advantages and disadvantages.

Contents

TTime::UniversalTime()

  • Resolution is in the microseconds range (on EKA2).
  • This timer uses the system time that can be changed by other programs
  • Tick period can be obtained by calling
TInt tickPeriod;
HAL::Get(HAL::ENanoTickPeriod, tickPeriod);

User::FastCounter()

  • Highest possible resolution of a Symbian OS timer
  • Faster than TTime::UniversalTime()
  • Tick period can be obtained by calling
TInt tickPeriod;
HAL::Get(HALData::EFastCounterFrequency, tickPeriod);

User::NTickCount() / NKern::TickCount()

  • Allows access to kernel tick count directly (user and kernel side)
  • does not lose time when device goes into standby
  • Tick period can be obtained by calling
HAL::Get(HAL::ENanoTickPeriod, tickPeriod); // User side
// or
TInt tickPeriod = NKern::TickPeriod() // Kernel side

Example code

This sample illustrates a way to calculate the time elapsed between two calls using TTime::UniversalTime().

...
TReal iFps; // frame per seconds
TTime iOldTime;
...
void CMyActiveObject::RunL()
	{
	TTime time;
	time.UniversalTime();
	// You may need to make sure that time counter is incremented 
        // to avoid division by zero
	iFps = 1000000 / time.MicroSecondsFrom( iOldTime ).Int64();
	iOldTime = time;
	}

Related Discussions

Thread Thread Starter Forum Replies Last Post
Timer pop up while thread is working? nadav70 General Symbian C++ 1 2008-02-24 01:21
Calling CActiveScheduler::Start() from inside a loop reuvend General Symbian C++ 16 2008-07-13 11:15
GPRS, Bluetooth and GPS mig_der Mobile Java General 10 2008-10-13 09:32
Help: "CPeriodic timer" compile error ? tiger zhou General Symbian C++ 2 2006-02-12 18:56
Call counters/timers Jasmijn General Discussion 1 2004-07-12 15:01

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Invite a friend Invite a friend
E-mail Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us Regional websites: Chinese Japanese © 2008 Nokia 
RDF Facets: qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX