## Chapter 16. Profile Analyzer

The sampling profiler included in the X-Forge core only works under ARM PockerPC.

To use the sampling profiler, you must first link your application with the sampling-enabled static library `xfcorep.lib` and `toolhelp.lib`. Next, set the compiler to output a `.map` file (project -> settings -> link, 'generate mapfile').

Next, add the following somewhere in the start of your application:

        XFcProfiler::startSampler();

and the following somewhere in the deinitialization:

        XFcProfiler::endSampler();

After these steps build your application, and run it on some ARM based PocketPC device. If the application does not run, the device does not contain `toolhelp.dll`. You can find this by searching for it in the `windows ce tools` tree.

Let the application run for 15 minutes or longer, and then quit it. You should then have the sampling data on the device. Copy this into a directory along with the `.map` file that the compiler generated, and run profileanalyzer (included in the 'other' directory) to generate profiling report.

The report is generated by running a thread at maximum priority and sampling the current instruction pointer addresses of all the threads in the program. As such the sampling is not even, plus if you have a thread that loops a single function this will be shown as a huge time eater. The sampling profiler does, however, give some kind of overview on where all the time is spent.

|  | X-Forge Documentation Confidential Copyright © 2003 Fathammer