![]() |
TIOVX User Guide
|
Explicitly setting logging levels creates flexibility for debugging specific graphs and nodes within an application. Debug levels can be set for specific graphs and nodes using the tivxSetGraphDebugZone and tivxSetNodeDebugZone APIs respectively. Including a vx_true_e flag enables a specified zone, and passing a vx_false_e flag disables a specified zone. Changing the debug levels of a given graph will also update the levels of each node that belongs to it. When a graph is created, each of its logging levels will be enabled or disabled to match the status of the global debug state. The debug levels of each newly created node will match those of the graph it belongs to.
Changes to the debug zones of graphs and nodes can be made even at runtime. This allows for more debug control over specific objects both before and after graph verification. To continue supporting the existing VX_PRINT mechanism, a set of different APIs must be used to take advantage of graph and node debug levels. VX_PRINT_GRAPH and VX_PRINT_NODE can be used at the application/framework levels to print statements based on the debug levels of a given graph or node. VX_PRINT_NODE can also be used within User Extension Kernel callbacks on the host side when a vx_node object is accessible. VX_PRINT_KERNEL can be used within User Target Kernel callbacks when a target_kernel_instance object is accessible. See the following examples for more information.
In order to print debug information for a specific graph, first enable/disable the desired debug zones using tivxSetGraphDebugZone.
These calls will enable the VX_ZONE_INFO zone and disable the VX_ZONE_WARNING zone for that graph. To add logging for this graph, call the following:
Because the level VX_ZONE_INFO has been enabled for the graph, this print statement will execute wherever it exists in the application/framework.
For this node, VX_ZONE_ERROR will be disabled while VX_ZONE_INFO is activated.
This print
will not be performed, but the following will:
In addition to application and framework use cases, VX_PRINT_NODE can be called within host-side user extension kernel callback functions. When these kernel callbacks are invoked within an application, the user kernel print statements will be executed assuming the required debug levels are enabled within the nodes that are instances of it. See the following example within the Not user kernel validate callback function:
Kernel-specific debug prints can also be added to user target kernel callback functions. This is achieved in a similar way as the host-side user kernel callbacks, but the API VX_PRINT_KERNEL is used instead. See the following example within the Not target kernel create callback function:
Yes - VX_PRINT still functions as usual. Separate print APIs were created to ensure backward compatibility is maintained and existing VX_PRINT calls continue to work properly.
The graph, node, and kernel prints can be used anywhere within an application, the framework, or a user extension kernel that a vx_graph, vx_node, or tivx_target_kernel_instance object are accessible. VX_PRINT can also be used in these places, but the specific API selection ultimately depends on the collection of debug levels the print statement will be evaluated against: the global core debug state or a local object's debug state.
The VX_PRINT API can be used anywhere throughout the framework for general debug print statements that are enabled as long as the global debug level is set appropriately. Extensions to the kernel that specifically access node and graph objects could potentially benefit from calling VX_PRINT_GRAPH and VX_PRINT_NODE. Debug statements would be enabled/disabled for each individual graph or node depending on each one's debug state.
Callback functions for host-side user kernels have access to a vx_node object, so these functions can benefit from using the VX_PRINT_NODE API. Some callback functions for the target user kernel have access to a tivx_target_kernel_instance object. In these locations, the VX_PRINT_KERNEL API can be leveraged. In both circumstances, the debug states of nodes that are created as instances of these user kernels will be checked against the required debug zone to print kernel-specific debug information.
Similiarly to framework extensions, both the VX_PRINT and graph/node/kernel print APIs are available for use within applications. The specific use case will determine which to use as it depends on the availability of vx_graph and vx_node objects.