.. index:: single: ports_profiler
.. _ports_profiler/0:

.. rst-class:: right

**object**

``ports_profiler``
==================

Predicate execution box model port profiler.

| **Availability:** 
|    ``logtalk_load(ports_profiler(loader))``

| **Author:** Paulo Moura
| **Version:** 3:0:0
| **Date:** 2026-09-04

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`tool_diagnostics_common <tool_diagnostics_common/0>`
|    ``public`` :ref:`options <options/0>`
| **Provides:**
|    :ref:`logtalk::debug_handler/1 <logtalk/0::debug_handler/1>`
|    :ref:`logtalk::debug_handler/3 <logtalk/0::debug_handler/3>`
| **Uses:**
|    :ref:`list <list/0>`
|    :ref:`logtalk <logtalk/0>`
|    :ref:`os <os/0>`
|    :ref:`type <type/0>`
|    :ref:`user <user/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`tool_diagnostics_protocol/0::diagnostic/2`  :ref:`tool_diagnostics_protocol/0::diagnostic/3`  :ref:`tool_diagnostics_protocol/0::diagnostic_rule/5`  :ref:`tool_diagnostics_protocol/0::diagnostic_rules/1`  :ref:`tool_diagnostics_protocol/0::diagnostic_target/1`  :ref:`tool_diagnostics_protocol/0::diagnostics/2`  :ref:`tool_diagnostics_protocol/0::diagnostics/3`  :ref:`tool_diagnostics_protocol/0::diagnostics_preflight/2`  :ref:`tool_diagnostics_protocol/0::diagnostics_preflight/3`  :ref:`tool_diagnostics_protocol/0::diagnostics_summary/2`  :ref:`tool_diagnostics_protocol/0::diagnostics_summary/3`  :ref:`tool_diagnostics_protocol/0::diagnostics_tool/5`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: start/0
.. _ports_profiler/0::start/0:

``start/0``
^^^^^^^^^^^

Activates the ports profiler for followup goals.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``start`` - ``one``


------------

.. index:: stop/0
.. _ports_profiler/0::stop/0:

``stop/0``
^^^^^^^^^^

Deactivates the ports profiler.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``stop`` - ``one``


------------

.. index:: data/0
.. _ports_profiler/0::data/0:

``data/0``
^^^^^^^^^^

Prints a table with all port profiling data.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``data`` - ``one``


------------

.. index:: data/1
.. _ports_profiler/0::data/1:

``data/1``
^^^^^^^^^^

Prints a table with all port profiling data for the specified entity.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``data(Entity)``
| **Mode and number of proofs:**
|    ``data(+entity_identifier)`` - ``one``


------------

.. index:: data/2
.. _ports_profiler/0::data/2:

``data/2``
^^^^^^^^^^

Prints a table with all port profiling data for the specified entity predicate (or non-terminal).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``data(Entity,Predicate)``
| **Mode and number of proofs:**
|    ``data(+entity_identifier,+predicate_indicator)`` - ``one``
|    ``data(+entity_identifier,+non_terminal_indicator)`` - ``one``


------------

.. index:: reset/0
.. _ports_profiler/0::reset/0:

``reset/0``
^^^^^^^^^^^

Resets all port profiling data.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``reset`` - ``one``


------------

.. index:: reset/1
.. _ports_profiler/0::reset/1:

``reset/1``
^^^^^^^^^^^

Resets all port profiling data for the specified entity.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``reset(Entity)``
| **Mode and number of proofs:**
|    ``reset(+entity_identifier)`` - ``one``


------------

.. index:: port/5
.. _ports_profiler/0::port/5:

``port/5``
^^^^^^^^^^

Enumerates, by backtracking, all collected port profiling data.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``port(Port,Entity,Functor,Arity,Count)``
| **Mode and number of proofs:**
|    ``port(?atom,?entity_identifier,?atom,?integer,?integer)`` - ``zero_or_more``


------------

.. index:: clause_location/6
.. _ports_profiler/0::clause_location/6:

``clause_location/6``
^^^^^^^^^^^^^^^^^^^^^

Enumerates, by backtracking, all collected profiled clause location data.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``clause_location(Entity,Functor,Arity,ClauseNumber,File,BeginLine)``
| **Mode and number of proofs:**
|    ``clause_location(?entity_identifier,?atom,?integer,?integer,?atom,?integer)`` - ``zero_or_more``


------------

.. index:: clause/5
.. _ports_profiler/0::clause/5:

``clause/5``
^^^^^^^^^^^^

Enumerates, by backtracking, all collected clause profiling data.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``clause(Entity,Functor,Arity,ClauseNumber,Count)``
| **Mode and number of proofs:**
|    ``clause(?entity_identifier,?atom,?integer,?integer,?integer)`` - ``zero_or_more``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

.. index:: clause_location_/6
.. _ports_profiler/0::clause_location_/6:

``clause_location_/6``
^^^^^^^^^^^^^^^^^^^^^^

Internal table of collected profiled clause location data.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``clause_location_(Entity,Functor,Arity,ClauseNumber,File,BeginLine)``
| **Mode and number of proofs:**
|    ``clause_location_(?entity_identifier,?atom,?integer,?integer,?atom,?integer)`` - ``zero_or_more``


------------

.. index:: port_/5
.. _ports_profiler/0::port_/5:

``port_/5``
^^^^^^^^^^^

Internal table of collected port profiling data.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``port_(Port,Entity,Functor,Arity,Count)``
| **Mode and number of proofs:**
|    ``port_(?atom,?entity_identifier,?atom,?integer,?integer)`` - ``zero_or_more``


------------

.. index:: clause_/5
.. _ports_profiler/0::clause_/5:

``clause_/5``
^^^^^^^^^^^^^

Internal table of collected clause profiling data.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``clause_(Entity,Functor,Arity,ClauseNumber,Count)``
| **Mode and number of proofs:**
|    ``clause_(?entity_identifier,?atom,?integer,?integer,?integer)`` - ``zero_or_more``


------------

.. index:: entity_defines_/2
.. _ports_profiler/0::entity_defines_/2:

``entity_defines_/2``
^^^^^^^^^^^^^^^^^^^^^

Internal cache for profiled predicates.

| **Compilation flags:**
|    ``dynamic``

| **Template:**
|    ``entity_defines_(Entity,Predicate)``
| **Mode and number of proofs:**
|    ``entity_defines_(?entity_identifier,?predicate_indicator)`` - ``zero_or_more``


------------

Operators
---------

(none)

