New developer tool: ports profiler

Announcements of new Logtalk releases and events

Moderator: Paulo Moura

Post Reply
Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

New developer tool: ports profiler

Post by Paulo Moura » Thu Aug 21, 2014 6:34 pm

Hi,

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
-------------------------------------------------------------------------------------
Note that two exit ports are shown. The "Exit" port shows deterministic exists while the "*Exit" port shows exists that leave choice-points. The tool supports showing (and resetting) all profiling data or the profiling data for a single entity. Feedback and suggestions for improvement are most welcome.

Happy logtalking!
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests