Symbian
Symbian OS Library

FAQ-0673 How do I use the Visual C++ Profiler with Symbian OS?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Development
Created: 09/01/2000 Modified: 09/12/2001
Number: FAQ-0673
Platform: Not Applicable

Question:
Visual C++ comes with profiling tools - can I use these tools with the WINS emulator to check the coverage of my test
programs?


Answer:
You need to use the MSVC++ PREP program (see the MSDN documentation for details). One major limitation is that profiling of dynamically loaded DLLs will be wrong if the DLL is loaded, released and loaded again, so you should probably consider profiling simple test programs rather than EPOC.EXE

The sequence of operations is fairly easy:
    cd \epoc32\release\wins\udeb
    prep /LV testprog.exe interesting.dll [interesting2.dll ...]
    profile testprog
    prep /M testprog
    This produces "testprog.pbt" which contains the result of the profiling run(s), and would be repeated for all of the test programs you are interested in.

    Another limitation of the system is that PREP can only combine profile output from multiple runs if the same executable is used each time. For a DLL with a wide range of functions (e.g. ESTLIB.DLL or GSMBSC.TSY) this means that the coverage report can only be generated for each separate test program, and can't be directly combined to produce an overall figure.

    This could be fixed by combining the PLIST output from each separate test to report lines covered in the DLL by any of the tests. This could be achieved using a Perl script, for example.

    The best form of plist output for this would be "plist /t /f", which looks like
      0 168 Microsoft 32-bit PLIST Version 1.00
      1 324 Profile: Line coverage, sorted by line
      3 1273 7917 1273
      4 2000 Jun 05 15:25 tmisc
      7 tmisc.exe \stdlib\tstlib\tmisc.c 23 1
      7 tmisc.exe \stdlib\tstlib\tmisc.c 27 1
      7 tmisc.exe \stdlib\tstlib\tmisc.c 29 1
      ...
      7 estlib.dll \e32\include\k32addr.h 81 1
      7 estlib.dll \stdlib\lstdio\wsetup.c 37 1
      7 estlib.dll \stdlib\lstdio\wsetup.c 46 1
      7 estlib.dll \stdlib\lstdio\wsetup.c 48 0
      7 estlib.dll \stdlib\lstdio\wsetup.c 49 0
      7 estlib.dll \stdlib\lstdio\wsetup.c 50 0
      The "7" lines are coverage records, and the 0 or 1 at the end of the line indicates if the line has been hit. The Perl script would have to accumulate this information updating the 0s with 1s, then display the information nicely along the lines of the normal plist output, or as a coverage % for each source file in the relevant modules.

      It only works if the relevant executable has been compiled for debugging, so it would only apply to \epoc32\release\wins\udeb\