3.6. Profiling Support
Prev | Chapter 3. Sourcery G++ Lite for MIPS ELF | Next

## 3.6. Profiling Support

Sourcery G++ Lite includes CS3 support for code profiling on MIPS ELF targets using gprof. To enable profiling, compile your program with the `-pg` option. You must also build your program with a hosted linker script.

You can run a program built with profiling from the debugger the same as you would any other hosted application. While your program is running, profiling data is saved in buffers in the heap memory area on the target. This may affect the amount of memory available to your application, and it is also possible that the profiler itself may run out of memory. Profiling data is written to a file on the host (`gmon.out`) only when your application exits. Since many embedded applications are structured to run indefinitely rather than exit, you may need to add an explicit `exit` call in order to collect profiling data.

For instructions on using the mips-sde-elf-gprof utility to process the collected `gmon.out` data, refer to the GNU Profiler (gprof) manual included with Sourcery G++ Lite.

Prev | Up | Next
3.5. Using Sourcery G++ with YAMON | Home | 3.7. Using Flash Memory