Clocking PROLOG processes

View: New views
4 Messages — Rating Filter:   Alert me  

Clocking PROLOG processes

by ComputationalLing :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am looking for a way to measure the amount of time it takes PROLOG to complete a process for a Computational Linguistics project.  For example, if I make a PROLOG query to an existing predicate, I'd like a way to know how long it took PROLOG to find the solution to the query.

Does anyone know of an easy way to do this?  Thanks for any help anyone can provide.

Re: Clocking PROLOG processes

by Uwe Lesta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



ComputationalLing schrieb:

> I am looking for a way to measure the amount of time it takes PROLOG to
> complete a process for a Computational Linguistics project.  For example, if
> I make a PROLOG query to an existing predicate, I'd like a way to know how
> long it took PROLOG to find the solution to the query.
>
> Does anyone know of an easy way to do this?  Thanks for any help anyone can
> provide.

try:
time(your_goal).

--

Kind regards

Uwe Lesta



_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

Re: Clocking PROLOG processes

by ComputationalLing :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks so much!  Do you happen to know if there is a way to have the interpreter report back the time in milliseconds, as hundredths of a second are causing my queries to be reported simply as 0.00 seconds?


Uwe Lesta wrote:

ComputationalLing schrieb:

> I am looking for a way to measure the amount of time it takes PROLOG to
> complete a process for a Computational Linguistics project.  For example, if
> I make a PROLOG query to an existing predicate, I'd like a way to know how
> long it took PROLOG to find the solution to the query.
>
> Does anyone know of an easy way to do this?  Thanks for any help anyone can
> provide.

try:
time(your_goal).

--

Kind regards

Uwe Lesta



_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@iai.uni-bonn.de
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

Re: Clocking PROLOG processes

by Jan Wielemaker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-15 at 13:04 -0700, ComputationalLing wrote:
> Thanks so much!  Do you happen to know if there is a way to have the
> interpreter report back the time in milliseconds, as hundredths of a second
> are causing my queries to be reported simply as 0.00 seconds?

The underlying statistics/2 reports time as floats.  The accuracy
depends on the OS.   In recent 5.7.x versions time/1 reports 3 digits
as an increasing number of OSes do support that (in others the last
digit is always 0).

In most cases, do something like this:

?- time(forall(between(1, 1000, _), mygoal)).

    Cheers --- Jan

_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog