Did you know ... | Search Documentation: |
library(statistics): Get information about resource usage |
This library provides predicates to obtain information about resource usage by your program. The predicates of this library are for human use at the toplevel: information is printed. All predicates obtain their information using public low-level primitives. These primitives can be use to obtain selective statistics during execution.
Stats | is a dict containing status, time and stack-size information about Thread. |
Note that is no portable way to get thread-specific CPU time. SWI-Prolog has implementations for Linux, Windows and MacOS. The automatic detection may work on some other operating systems.
call_time/2 is defined as below. Note that for call_time/2 the time is only available if Goal succeeds.
call_time(Goal, Time) :- call_time(Goal, Time, Result), call(Result).
Result | is one of true , false
or throw(E) , depending on whether or not the goal succeeded
or raised an exception. Note that
Result may be called using call/1
to propagate the failure or exception. |
There is some functionality for statistics which is hard to find in the manual.
This chapter, Obtaining Runtime Statistics, lists the following predicates:
library(statistics)
library(statistics)
The fact that the predicates are part of library(statistics)
is shown in the header of the page, but the corresponding link directs back to Obtaining Runtime Statistics, not to library(statistics)
library(statistics)
does not show up in the search bar, but can be found as:
The lead-in text says:
The predicates of this library are for human use at the toplevel: information is printed.
It provides the following, two of which are listed above
The chapter, Execution Profiling is separate and lists further predicates provided by library(statistics)
: