This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/pl/profile.yap
vsc 1088b6cf0f fix debugger message for EOF input
fix fix to setof
fix profiler spewing out hidden atoms.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1449 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2005-11-10 01:27:13 +00:00

61 lines
1.7 KiB
Prolog

/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: profile.yap *
* Last rev: 8/2/88 *
* mods: *
* comments: Some profiling predicates available in yap *
* *
*************************************************************************/
:- meta_predicate profile_data(:,+,-).
profile_data(M:D, Parm, Data) :- P = M:D, !,
(
var(M) ->
'$do_error'(instantiation_error,profile_data(M:D, Parm, Data))
;
'$profile_data'(D, Parm, Data, M)
).
profile_data(P, Parm, Data) :-
'$current_module'(M),
'$profile_data'(P, Parm, Data, M).
'$profile_data'(P, Parm, Data,M) :- var(P), !,
'$profile_data_for_var'(P, Parm, Data,M).
'$profile_data'(M:P, Parm, Data, _) :- !,
'$profile_data'(P, Parm, Data, M).
'$profile_data'(P, Parm, Data, M) :-
'$profile_data2'(P, Parm, Data, M).
'$profile_data2'(Na/Ar,Parm,Data, M) :-
functor(P, Na, Ar),
'$profile_info'(M, P, Stats),
'$profile_say'(Stats, Parm, Data).
'$profile_data_for_var'(Name/Arity, Parm, Data, M) :-
'$current_predicate'(M,Name,Arity),
functor(P,Name,Arity),
\+ '$hidden'(Name), % don't show hidden predicates.
'$profile_info'(M, P, Stats),
'$profile_say'(Stats, Parm, Data).
'$profile_say'('$profile'(Entries, _, _), calls, Entries).
'$profile_say'('$profile'(_, _, Backtracks), retries, Backtracks).
profile_reset :-
current_module(M),
'$current_predicate'(M,Na,Ar),
functor(P,Na,Ar),
'$profile_reset'(M, P),
fail.
profile_reset.