[ library(util) | Reference Manual | Alphabetic Index ]

# time(+Goal)

Run Goal to first solution, and print timings

Goal
  A callable term

## Description

Call the goal Goal (as with once/1), and print the timings after the goal has succeeded or failed. The four times printed are:

            - thread cputime (of the calling thread only)
            - process cputime user (all threads)
            - process cputime system (all threads)
            - real time

Note that for multithreaded programs, the total process cputime can be higher than the elapsed real time, because all the threads' cputimes add up.

### Modes and Determinism

- time(+) is semidet

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

## Examples

        ?- time( for(_,1,1000000) do true ).

        Success, times: 1.0222s thread, 1.0200+0.0000s process, 1.03s real