[comp.lang.prolog] Profiler Availability

plummer@cs.swarthmore.edu (David Barker-Plummer) (10/23/90)

Are there any freely available program profilers out there?  I have a
(very) large Prolog program and I want to find out which predicates
are called, and how often, to find out where the time goes.
Basically, what I am looking for is an interpreter that keeps count of
calls.  Sure I could write one, but if there's one out there I'd like
to use it.

The program in question is in Quintus, in case that matters.

-- Dave

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (10/24/90)

In article <YN3R0TB@cs.swarthmore.edu>, plummer@cs.swarthmore.edu (David Barker-Plummer) writes:
> Are there any freely available program profilers out there?  I have a
> (very) large Prolog program and I want to find out which predicates
> are called, and how often, to find out where the time goes.
> Basically, what I am looking for is an interpreter that keeps count of
> calls.  Sure I could write one, but if there's one out there I'd like
> to use it.

> The program in question is in Quintus, in case that matters.

You don't need an interpreter.  There is in fact a tool in the library
which does just what you're asking for:  provide counts of how often
each predicate is called.

	| ?- use_module(library(count)).	% load the package
	| ?- count(foobaz).			% instead of compile(foobaz)
	| ?- clear_counts.			% set all counters to 0
	| ?- run_the_foobaz_code.		% run the code to be profiled
	| ?- write_counts('foobar.cts').	% store the counts in a file

Remember, "use the source!"  If you're still using an old version of the
library, ask Quintus to provide you with count.pl and count.c.

This is nowhere near as good as the profiling facilities built into
SICStus Prolog version 0.7, but it's a start.
-- 
Fear most of all to be in error.	-- Kierkegaard, quoting Socrates.