Display die Ausführungszeiten für jedes Ziel einer Prädikatklausel
Ich möchte die Ausführungszeit innerhalb der Ziele des Prädikats mit @ seheSICStus Prolog.
Beispiel:
pred :-
goal1,
time,
goal2,
time.
go :-
call(pred).
time_go :-
go,
times(go).
Erwartetes Ergebnis
?- time_go.
times_go = 1000ms ,
times_go_goal1 = 500ms,
times_go_goal2 = 500ms
Wie geht das
Ich habe es versuchttime_out(:Goal, +Time, -Result)
vonlibrary(timeout)
aber ich habe diesen Fehler bekommen:
| ?- time_out(char_code(a,N), T, Res).
! Instantiation error in argument 2 of user:time_out/3
! goal: time_out(user:char_code(a,_193),_179,_181)
| ?- time_out(char_code(a,N), 1000, Res).
N = 97,
Res = success ? ; % Res=timeout in other example