[ library(profile) | Reference Manual | Alphabetic Index ]
profile(+Goal, ++Options)
Execute Goal (once) and print the time spent in each predicate.
- Goal
- Callable term
- Options
- List of options
Description
    Runs the given goal with the sampling profiler, which collects
    information about the currently executing predicate 100 times
    per second.  After the goal finishes, a result table is printed.
    ECLiPSe must have been started with the -P command line option
    (or equivalent) in order to support profiling.  It is, however, not
    necessary to compile the profiled code in a particular way; the profiler
    works independently of compiler optimizations and debug mode.
    Possible options:
    
    - keep_file
- 
	don't destroy the samples file <tmp_dir>/eclipse.prof.<pid>
	that is used to collect profiling information during execution.
	Without this option, the file is automatically deleted.
    
    Notes:
    
    - Garbage collection time is shown as predicate garbage_collect/0,
    even when garbage collection was automatically triggered.
- The time spent in simple predicates (i.e. those with call_type
    external, written in C) is counted towards their parent predicate.
- In cases where the predicate name is not available, e.g. local goals in
    a locked module, the information is grouped under a blank predicate
    name entry for the module.
Modes and Determinism
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Examples
?- profile(length(_,100000000), []).
		  PROFILING STATISTICS
		  --------------------
Goal:		  length(_80, 100000000)
Result:		  success
Sampling rate:	  every 0.01s process_cputime
Samples taken:	  182
Thread cputime:	  1.82s
Predicate	      Module	    %Time    Time   %Cum
---------------------------------------------------------
length            /2  sepia_kernel  79.7%    1.45s  79.7%
garbage_collect   /0  sepia_kernel  20.3%    0.37s 100.0%
Yes (1.86s cpu)
See Also
get_flag / 2, profile / 1