• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

A.53 library(statistics): Get information about resource usage
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(statistics): Get information about resource usage
          • statistics/0
          • statistics/1
          • thread_statistics/2
          • time/1
          • call_time/2
          • call_time/3
    • Packages
Availability::- use_module(library(statistics)).(can be autoloaded)
Sourcecall_time(:Goal, -Time:dict)
call_time(:Goal, -Time:dict, -Result)
Call Goal as call/1, unifying Time with a dict that provides information on the resource usage. If Goal succeeds with a choice point, backtracking reports the time used to find the next answer, failure or exception. If Goal succeeds deterministically no choice point is left open. Currently Time contains the keys below. Future versions may provide additional keys.

  • wall:Seconds
  • cpu:Seconds
  • inferences:Count

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.
ClioPatria (version V3.1.1-51-ga0b30a5)