I am unable to run the new GUI version on my old MacOS config. Since I converted to the commandline version some time ago, this is no big deal but I did lose one thing that I valued, namely the ability to display and browse the profiler data in an X-window. The current text-only version is considerably inferior to the xpce version, so I spent some time enhancing it.
For the many who have probably never seen it, an example of the current text-only version looks like:
=====================================================================
Total time: 0.896 seconds
=====================================================================
Predicate Box Entries = Calls+Redos Time
=====================================================================
clpBNR:getValue/2 286,017 = 286,017+0 16.4%
clpBNR:pt_powrCase/6 47,748 = 47,748+0 16.2%
clpBNR:doNode_/7 95,382 = 95,382+0 15.1%
clpBNR:linkNodeList_/3 142,862 = 142,862+0 9.7%
clpBNR:linkNode_/3 95,382 = 95,382+0 7.9%
true.
Currently, the experimental enhanced version of the same data:
======================================================================================================
Number of nodes: 422 [ports(true)] Total time: 0.884 seconds
Predicate Calls + Redos Exits + Fails Time:Self + Time:Children
======================================================================================================
clpBNR:getValue/2 286,017 + 0 286,017 + 0 0.15s.( 16.4%) + 0.00s.( 0.0%)
clpBNR:pt_powrCase/6 47,748 + 0 47,748 + 0 0.14s.( 16.2%) + 0.00s.( 0.0%)
clpBNR:doNode_/7 95,382 + 0 95,339 + 43 0.13s.( 15.1%) + 0.72s.( 81.2%)
clpBNR:linkNodeList_/3 142,862 + 0 142,862 + 0 0.09s.( 9.7%) + 0.07s.( 7.9%)
clpBNR:linkNode_/3 95,382 + 0 95,382 + 0 0.07s.( 7.9%) + 0.00s.( 0.0%)
======================================================================================================
true.
Note that the time values in this version are slightly smaller because they’re based on net time with the profiler overhead removed. And it still lacks the call graph and interactive browsing capability of the GUI version.
The enhanced version is implemented as:
:- module(terminal_show_profile, []).
:- use_module(library(prolog_profile), [profile_data/1, profile_procedure_data/2]).
using the prolog:show_profile_hook/1
, so it just has be be loaded into a non-xpce version of SWIP to use it (not sure how multiple hook instances would work).
Possible future options:
- publish the existing module as an add-on pack for those few who might have similar requirements to me. Requires installation and explicit load to use it.
- generate a PR for
library(prolog_profile)
to provide an equivalent as the default text representation. (i.e., just becomes part of the release so no action required by the user). - do nothing; insufficient general interest so it just stays in my local toolbox.
Any opinions? Feedback on enhanced format?