Next: , Previous: Profiling introduction, Up: Profiling   [Contents][Index]

8.2 Building profiled applications

To enable profiling, your program must be built with profiling enabled. The three different profilers require different support, and thus you must choose which one to enable when you build your program.

If you are using Mmake, then you pass these options to all the relevant programs by setting the ‘GRADEFLAGS’ variable in your Mmakefile, e.g. by adding the line ‘GRADEFLAGS=--profiling’. (For more information about the different grades, see Compilation model options.)

Enabling ‘mprof’ or ‘mdprof’ profiling has several effects. First, it causes the compiler to generate slightly modified code, which counts the number of times each predicate or function is called, and for every call, records the caller and callee. With deep profiling, there are other modifications as well, the most important impact of which is the loss of tail-recursion. (By default, the deep profiling versions of the library and runtime are built with ‘--stack-segments’ in order to minimize this impact.) Second, your program will be linked with versions of the library and runtime that were compiled with the same kind of profiling enabled. Third, if you enable graph profiling, the compiler will generate for each source file the static call graph for that file in ‘’.

Enabling ‘threadscope’ profiling causes the compiler to build the program against a different runtime system. This runtime system logs events relevant to parallel execution. ‘threadscope’ support is not compatible with all processors, see README.ThreadScope for more information.

Next: , Previous: Profiling introduction, Up: Profiling   [Contents][Index]