Symbian
Symbian OS Library

FAQ-0426 Symbian OS Profiling Tools?

[Index][spacer] [Previous]



 

Classification: C++ Category: Utilities & Build Tools
Created: 10/29/99 Modified: 09/04/2001
Number: FAQ-0426
Platform: ER5, Symbian OS v6.0, Symbian OS v6.1

Question:
Are there any profiling tools that work with Symbian OS Code?

Answer:
On WINS:
The MSVC Profiler will do Symbian OS code coverage, but the time performance profiling doesn't work.

However TrueTime (a Visual C++ profiler from NuMega http://www.numega.com/ ) will do time performance profiling. Note that if you explicitly run Symbian OS code under TrueTime or attempt to profile some part of the kernel, it fails. But if you exclude all possible DLLs, compile the bits you're interested with TrueTime, and run it (normally; not using the 'run with TrueTime' option), it then generates loads of profiling data, which you can look at with quite a neat GUI.

On MARM:

Use the RDebug::Profile... functions in e32svr.h

Symbian OS supports up to 64 simultaneous profile areas of code ('bins'). The bins are numbered, and it's the responsibilty of the programmer to assign the numbers to areas of code (usually functions).

You use the profile functions to instrument functions or areas of code. You put RDebug::ProfileStart( binNumber ) at the start of the each area to be profiled, and RDebug::ProfileEnd( binNumber ) at the end of the area. It's best to make macros of these so these don't compile into the final code.

You start profiling using RDebug::ProfileReset, run the tests, then you use RDebug::ProfileResult to get the results into a TProfile struct for each bin. Each bin provides two figures:

Time: This is the total cumulative time in microseconds the system has been in the function. There's only a few clock ticks per second, so this is very very approximate.
Count: The number of times the RDebug::ProfileStart has been called for that bin.

The attached file gives some annotated sample code taken from a Symbian OS application.

Summary of Symbian OS Profiling Functions

RDebug::ProfileReset( TInt aStartBin, TInt aNumberOfBins )
Resets to zero aNumberOfBins, starting with bin aStartBin

RDebug::ProfileStart( TInt aBin )
Called on entry to the code corresponding to a particular bin.

RDebug::ProfileEnd( TInt aBin )
Called on exit to the code corresponding to a particular bin.

RDebug::ProfileResult( TProfile* anArrayOfTProfile, TInt aStartBinNumber, TInt aNumberOfBins )
Returns the profile information into anArrayOfTProfile. This class is as follows (the members are described above):


    class TProfile
    {
    public:
    TInt iTime;
    TInt iCount;
    };