A Profiler for the Multi-Paradigm
Declarative Language Curry
(Version v1.1 of 23/05/2003)
This is a source-level abstract profiler for the multi-paradigm language Curry. It has been implemented in Curry itself by Elvira Albert and Germán Vidal. The profiling tool is able to deal with programs containing local declarations, higher-order functions, and several built-in functions.
The profiler considers programs written in Curry and translates programs to an intermediate language, FlatCurry, in order to profile them. This is essential to express the above language features at an appropriate level of abstraction. In this way, the resulting tool can be used to profile "real" Curry programs.
Two main features characterize our profiler:
Cost centers are marked with the (built-in) function SCC (for Set Cost Center). For instance, given the program excerpt:
length_app x y = length (append x y)
length [] = 0
length (x:xs) = (length xs) + 1
append [] ys = ys
append (x:xs) ys = x : append xs ys
You can introduce the following annotations:
length_app x y = SCC 2 (length (SCC 1 (append x y)))
In this way, the cost of evaluating ``append x y'' is attributed to the cost center 1, while the cost of evaluating ``length (append x y)'' is attributed to the cost center 2 by excluding the costs already attributed to 1.
A complete description of the source-level abstract profiler can be found in [AV01].
The source file of the profiler is profiler.curry. Programs to be profiled should contain two additional functions:
MAIN x = x
SCC _ y = y
MAIN is used to annotate the initial call (e.g., foo = MAIN (initial call)), while SCC is used to mark cost centers (as shown above). In order to see the system running, you can load bench.curry and execute:
profiler> profile "bench"
You can also check the programs colormap.curry and lenapp.curry. Additionally, you can execute "profileAcc" to accumulate the costs of previous nondeterministic derivations. For instance, you can type
profiler> profileAcc "colormap"
to obtain the costs for the whole search space of the well-known colormap program.
Please report any bug or comment to gvidal@dsic.upv.es.
MIST | ELP | GPLIS | DSIC | UPV |
Last update May 2003 # gvidal (at) dsic (dot) upv (dot) es