If you just want to *see* the execution time for debugging, you can use SWI-Prolog’s built-in time/1 predicate:

```
?- time(some_slow_code).
% 7,940,026 inferences, 1.144 CPU in 1.152 seconds (99% CPU, 6939812 Lips)
true.
```

(The “1.152 seconds” is the walltime value that you’re looking for.)

But time/1 only prints the time statistics and doesn’t return them. If you want to store or accumulate the times, you need to use statistics/2 directly.

To clarify, statistics/2 doesn’t take any inputs - both entries in the list are output values. `TimeSinceStart`

is the walltime since the Prolog process was started, and `TimeSinceLastCall`

is the time since the last `statistics(walltime, ...)`

call (both in milliseconds). It’s easiest to understand if you try it out interactively:

```
?- statistics(walltime, Stats).
Stats = [1323, 1323].
?- statistics(walltime, Stats).
Stats = [3010, 1687].
```

In this example, the first statistics/2 call was 1.3 seconds after Prolog was started, and the second one was 3.0 seconds after Prolog was started and 1.7 seconds after the first call.