Get predicate runtime in seconds

I am looking for a way to get the predicate runtime in seconds using swi-proog. I found time(X)one that brings me this information and much more, but I only need the time in seconds, wath, which I would like to write after running the predicate.

Is there any way to do this?

+2
source share
1 answer

To get the elapsed execution time that was being performed to accomplish the specified goal, you can use call_time/2:

?- call_time(true,T_ms).
T_ms = 0.

Remember, it T_msmeasures milliseconds, not seconds!

To jump to seconds, use an additional target, for example T is T_ms * 0.001.

call_time/2, .

+2

Source: https://habr.com/ru/post/1624428/


All Articles