A new developer tool, "ports", a port profiler is now available from the Logtalk 3 git repository:
https://github.com/LogtalkDotOrg/logtal ... ools/ports
This tool is based on the same predicate execution box model used by the debugger. It counts the number of times each port is traversed during the execution of queries and can be used for performance analysis. Tool usage is simple and requires only loading it and compiling the code you want to profile in debug mode. For example:
Code: Select all
| ?- {ports(loader)}.
...
| ?- set_logtalk_flag(debug, on).
...
| ?- {searching(loader)}.
...
| ?- miss_cann::initial_state(Initial), hill_climbing(16)::solve(miss_cann, Initial, Path, Cost), miss_cann::print_path(Path).
...
| ?- ports::data.
-------------------------------------------------------------------------------------
Entity Predicate Fact Rule Call Exit *Exit Fail Redo Error
-------------------------------------------------------------------------------------
list member/2 12 1 13 0 13 1 1 0
list reverse/2 0 1 1 1 0 0 0 0
list reverse/4 1 12 13 13 0 0 0 0
list sort/2 0 12 12 12 0 0 0 0
loop forto/3 0 48 48 48 0 0 0 0
loop forto_aux/5 0 120 120 120 0 0 0 0
miss_cann goal_state/2 1 0 13 1 0 12 0 0
miss_cann heuristic/2 0 15 15 15 0 0 0 0
miss_cann initial_state/2 1 0 1 1 0 0 0 0
miss_cann next_state/3 0 66 18 0 38 18 38 0
miss_cann print_state/1 0 12 12 12 0 0 0 0
state_space goal_state/1 0 13 13 1 0 12 0 0
state_space initial_state/1 0 1 1 1 0 0 0 0
state_space member_path/2 0 103 118 22 0 96 0 0
state_space print_path/1 1 12 13 13 0 0 0 0
heuristic_search/1 solve/4 0 1 1 0 1 0 0 0
heuristic_search/1 threshold/1 0 1 1 1 0 0 0 0
hill_climbing/1 hill/7 0 25 13 0 12 1 0 0
hill_climbing/1 search/5 0 1 1 0 1 0 0 0
-------------------------------------------------------------------------------------
Happy logtalking!