The Ciao Profiler

Author(s): Edison Mera.

The Ciao profiler provides a high-level, flexible way to mark a predicate (or a literal) for profiling. This is done by using declarations to indicate if a program element must be instrumented or not.

By default, if the user does not specify anything, no predicate inside the module will be instrumented as cost center for profiling. The use of at least one declaration saying that a specific predicate must be instrumented overrides this behavior.

The declaration is as follows:

	:- cost_center pred1/Arity1, ... predN/ArityN.

where pred1/Arity1, ..., predN/ArityN are the predicates to be instrumented as cost centers. They can be separated by commas or the can be in a list.

By default the engine hooks of all defined cost center are active. The declaration:

      (predN/ArityN,nohooks)	

will deactivate them.

Another useful declaration makes possible to indicate that a given predicate is not going to be instrumented as cost center:

	:- no_cost_center pred1/Arity1, ... predN/ArityN.

where pred1/Arity1, ..., predN/ArityN are the predicates that will not be instrumented as cost centers. There are two options (as in the previous case): write one assertion for each predicate or declare more than one predicate (separated by commas or in a list) in only one assertion.

The following assertions define the behavior of all the predicates of the module:

	:- all_cost_center.

	:- all_no_cost_center.

They specify respectively that all the predicates in the module will be instrumented as cost centers and that no predicate in the module will be instrumented as cost center. In the first assertion the engine hooks of all defined cost centers are active. The declaration :- all_cost_center(nohooks). will deactivate them.

Cost centers can be also defined at literal level replacing the literal by the declaration:

	:- cost_center(name_cc, literal)

where literal is the program literal and name_cc is the name of its associated cost center. At predicate level the name of both cost center and predicate are equal.

Usage and interface

  • Library usage:
    The Ciao profiler is used by including profiler in the package inclusion list of a module, or by means of an explicit :- use_package(profiler). directive.
  • Imports: