Profile program executions

The execution profiler counts the number of times that each predicate is called during execution. This profiler is helpful for identifying the portion of predicates that are most frequently executed.

In order to gauge the execution of a program, follow the following steps:

  1. Compile the program with gauging calls and predicates inserted. In order to do so, either set the Prolog flag compiling to profilecode before compiling
          ?-set_prolog_flag(compiling,profilecode).
          ?-cl(filename).
    
    or use profile_consult(filename) to load the source code.

  2. init_profile. Initialize the counters.

  3. Execute a goal.

  4. profile. Report the results.



Neng-Fa Zhou 2013-01-25